Juan Hernandez has uploaded a new change for review.

Change subject: core: Use .pgpass from home in dev env
......................................................................

core: Use .pgpass from home in dev env

We use the .pgpass file from /etc/ovirt-engine in production
environments, but this doesn't exist or is not available in most
development environments, so we should try to use the file from user's
home directory. If we don't do that the create_db_devel.sh script keeps
asking for the database password for ever.

Change-Id: I87e36c169dcf3a0aa1914ed46ccea068231d6b6d
Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com>
---
M backend/manager/dbscripts/dbcustomfunctions.sh
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/9417/1

diff --git a/backend/manager/dbscripts/dbcustomfunctions.sh 
b/backend/manager/dbscripts/dbcustomfunctions.sh
index df06750..53cfcf9 100755
--- a/backend/manager/dbscripts/dbcustomfunctions.sh
+++ b/backend/manager/dbscripts/dbcustomfunctions.sh
@@ -15,7 +15,16 @@
     USERNAME=""
     VERBOSE=false
     LOGFILE="$ME.log"
-    export PGPASSFILE="/etc/ovirt-engine/.pgpass"
+
+    # 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="/etc/ovirt-engine/.pgpass"
+    if [ ! -r "${PGPASSFILE}" ]
+    then
+        PGPASSFILE="${HOME}/.pgpass"
+    fi
+    export PGPASSFILE
 }
 
 #refreshes views


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87e36c169dcf3a0aa1914ed46ccea068231d6b6d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to