mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-12-16 01:30:35 +00:00
quote psql password in scripts
This commit is contained in:
parent
0c5afff356
commit
a386a710b7
@ -5,7 +5,6 @@
|
||||
#
|
||||
host=<%=@host%>
|
||||
user=<%=@dbbackup_user%>
|
||||
pass=<%=@dbbackup_password%>
|
||||
|
||||
<% if (@dbbackup_user == 'root' && @dbbackup_password == '') -%>
|
||||
dbs=(
|
||||
|
@ -5,14 +5,12 @@
|
||||
#
|
||||
host=<%=@host%>
|
||||
user=<%=@dbbackup_user%>
|
||||
pass=<%=@dbbackup_password%>
|
||||
|
||||
#PGPASSWORD="$pass"
|
||||
dbs=(
|
||||
$(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-%>'\"")
|
||||
$(ssh -l <%=@backup_user-%> "$host" "PGPASSWORD='<%=@dbbackup_password%>' 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" "PGPASSWORD=${pass} <%=@dumper-%> -U ${user} <%=@dump_flags-%> ${db}" > "$db".sql
|
||||
ssh -l <%=@backup_user-%> "$host" "PGPASSWORD='<%=@dbbackup_password%>' <%=@dumper-%> -U ${user} <%=@dump_flags-%> ${db}" > "$db".sql
|
||||
wait
|
||||
<% if @compress != '' -%>
|
||||
<%=@compress-%> "$db".sql
|
||||
|
Loading…
Reference in New Issue
Block a user