Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: engine-backup: Refuse restoring to non-empty db
......................................................................

packaging: engine-backup: Refuse restoring to non-empty db

Revert I8bdd8c01349b3cb2a4b1ab79a048c09479c23f27 .

Refuse to restore to a non-empty database.

Bug-Url: https://bugzilla.redhat.com/1020277
Change-Id: I83d500e2a59e30d40c15cbde82b84d12206028dd
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/bin/engine-backup.sh
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/55/20455/1

diff --git a/packaging/bin/engine-backup.sh b/packaging/bin/engine-backup.sh
index 9f2dda3..389a4c6 100755
--- a/packaging/bin/engine-backup.sh
+++ b/packaging/bin/engine-backup.sh
@@ -250,7 +250,6 @@
 backupDB() {
        local file="$1"
        PGPASSFILE="${MYPGPASS}" pg_dump \
-               -c \
                -E "UTF8" \
                --disable-dollar-quoting \
                --disable-triggers \
@@ -315,6 +314,15 @@
                -c "select 1" \
                >> "${LOG}" 2>&1 \
                || logdie "Can't connect to the database"
+
+       PGPASSFILE="${MYPGPASS}" pg_dump \
+               -U "${ENGINE_DB_USER}" \
+               -h "${ENGINE_DB_HOST}" \
+               -p "${ENGINE_DB_PORT}" \
+               "${ENGINE_DB_DATABASE}" | \
+               grep -vi '^create extension' | \
+               grep -iq '^create' && \
+               logdie "Database is not empty"
 }
 
 verifyVersion() {


-- 
To view, visit http://gerrit.ovirt.org/20455
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83d500e2a59e30d40c15cbde82b84d12206028dd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to