Alon Bar-Lev has uploaded a new change for review.

Change subject: db: do not fallback if ENGINE_PGPASS is specified
......................................................................

db: do not fallback if ENGINE_PGPASS is specified

existence of ENGINE_PGPASS within environment tells us to use a specific
file, do not fallback to anything else in this mode.

Change-Id: I0a92784c12d9fc8fcde6a57043c15cb2e7cc37db
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/dbscripts/backup.sh
M packaging/dbscripts/dbcustomfunctions.sh
2 files changed, 8 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/16615/1

diff --git a/packaging/dbscripts/backup.sh b/packaging/dbscripts/backup.sh
index 40f4260..5bf68a8 100755
--- a/packaging/dbscripts/backup.sh
+++ b/packaging/dbscripts/backup.sh
@@ -12,8 +12,6 @@
 #setting defaults
 set_defaults
 
-ENGINE_PGPASS=${ENGINE_PGPASS:-/etc/ovirt-engine/.pgpass}
-
 usage() {
     printf "Usage: ${ME} [-h] [-s SERVERNAME] [-p PORT] [-d DATABASE] [-l DIR] 
[-f FILENAME] -u USERNAME [-c] [-v] \n"
     printf "\n"
@@ -84,7 +82,7 @@
     cmd="${cmd} -v"
 fi
 
-PGPASS_FILE="${ENGINE_PGPASS}" ${cmd}
+${cmd}
 
 if [ $? -eq 0 ];then
     echo "Backup of database $DATABASE to $file completed."
diff --git a/packaging/dbscripts/dbcustomfunctions.sh 
b/packaging/dbscripts/dbcustomfunctions.sh
index f92830d..d6b3aba 100755
--- a/packaging/dbscripts/dbcustomfunctions.sh
+++ b/packaging/dbscripts/dbcustomfunctions.sh
@@ -21,15 +21,14 @@
     LC_ALL="C"
     export LC_ALL
 
-    # When running in development environments the .pgpass file may not
-    # exist or might not be readable, so we should try to use the file
-    # stored in the home directory of the user instead:
-    PGPASSFILE="${ENGINE_PGPASS:-/etc/ovirt-engine/.pgpass}"
-    if [ ! -r "${PGPASSFILE}" ]
-    then
-        PGPASSFILE="${HOME}/.pgpass"
+    if [ -n "${ENGINE_PGPASS}" ]; then
+        export PGPASSFILE="${ENGINE_PGPASS}"
+    else
+        export PGPASSFILE="/etc/ovirt-engine/.pgpass"
+        if [ ! -r "${PGPASSFILE}" ]; then
+            export PGPASSFILE="${HOME}/.pgpass"
+        fi
     fi
-    export PGPASSFILE
 }
 
 #refreshes views


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

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

Reply via email to