Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: engine-backup: Fix for postgresql 8
......................................................................

packaging: engine-backup: Fix for postgresql 8

pg_cmd used to always pass '-d database' to all pg commands.

This breaks on postgresql8's pg_dump, which only accepts the database
name as a non-option argument.

Change-Id: Ia1164822326ad117e960309f914450b4eefb2c98
Bug-Url: https://bugzilla.redhat.com/1222553
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M packaging/bin/engine-backup.sh
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/41118/1

diff --git a/packaging/bin/engine-backup.sh b/packaging/bin/engine-backup.sh
index d507525..6ad3ccb 100755
--- a/packaging/bin/engine-backup.sh
+++ b/packaging/bin/engine-backup.sh
@@ -664,7 +664,15 @@
 pg_cmd() {
        local cmd="$1"
        shift
-       PGPASSFILE="${MYPGPASS}" "${cmd}" -w -U "${user}" -h "${host}" -p 
"${port}" -d "${database}" "$@"
+
+       local use_d=
+       # pg_dump 8.x does not accept '-d database'.
+       # psql and pg_dump accept it as first non-option argument.
+       # pg_restore requires '-d'.
+       [ "${cmd}" = "pg_restore" ] && use_d=1
+
+       log "pg_cmd running: ${cmd} -w -U ${user} -h ${host} -p ${port} 
${use_d:+-d} ${database} $*"
+       PGPASSFILE="${MYPGPASS}" "${cmd}" -w -U "${user}" -h "${host}" -p 
"${port}" ${use_d:+-d} "${database}" "$@"
 }
 
 dobackup() {


-- 
To view, visit https://gerrit.ovirt.org/41118
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1164822326ad117e960309f914450b4eefb2c98
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to