1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-12-16 09:40:35 +00:00

move PGPASSWD variable into ssh command (so it is available on the node)

This commit is contained in:
Norbert Varzariu 2016-01-25 08:56:04 +01:00
parent 8dd6298c56
commit d252ac64a0

View File

@ -7,12 +7,12 @@ host=<%=@host%>
user=<%=@dbbackup_user%>
pass=<%=@dbbackup_password%>
PGPASSWORD="$pass"
#PGPASSWORD="$pass"
dbs=(
$(ssh -l <%=@backup_user-%> "$host" "psql -U ${user} -Atc \"SELECT datname FROM pg_database WHERE NOT datistemplate AND NOT datname ~ '<%@ignore_dbs.each do |db|-%><%if db == @ignore_dbs.last-%><%=db-%><%else-%><%=db-%>|<%end-%><%end-%>'\"")
$(ssh -l <%=@backup_user-%> "$host" "PGPASSWORD=${pass} psql -U ${user} -Atc \"SELECT datname FROM pg_database WHERE NOT datistemplate AND NOT datname ~ '<%@ignore_dbs.each do |db|-%><%if db == @ignore_dbs.last-%><%=db-%><%else-%><%=db-%>|<%end-%><%end-%>'\"")
)
for db in "${dbs[@]}"; do
ssh -l <%=@backup_user-%> "$host" "<%=@dumper-%> -U ${user} <%=@dump_flags-%> ${db}" > "$db".sql
ssh -l <%=@backup_user-%> "$host" "PGPASSWORD=${pass} <%=@dumper-%> -U ${user} <%=@dump_flags-%> ${db}" > "$db".sql
wait
<% if @compress != '' -%>
<%=@compress-%> "$db".sql