Alex Lourie has uploaded a new change for review.

Change subject: packaging: Updating env with correct pgpassword
......................................................................

packaging: Updating env with correct pgpassword

This patch updates execExternalCmd command with
correct PGPASSFILE environment value allowing
execution of DB commands.

Change-Id: Icb5fa0cc9fbae131ce028a3346a328cc1d43da74
Bug-Url: https://bugzilla.redhat.com/974064
Signed-off-by: Alex Lourie <[email protected]>
---
M packaging/common_utils.py
1 file changed, 14 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/60/15660/1

diff --git a/packaging/common_utils.py b/packaging/common_utils.py
index 4f7e564..e8e8653 100755
--- a/packaging/common_utils.py
+++ b/packaging/common_utils.py
@@ -307,9 +307,20 @@
     executes a shell command, if fail_on_error is True, raises an exception
     '''
     logging.debug("cmd = %s" % (command))
-    pi = subprocess.Popen(command, shell=True,
-        stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE)
+
+    # Update os.environ with env if provided
+    env = os.environ.copy()
+    if not "PGPASSFILE" in env:
+        env["PGPASSFILE"] = FILE_PG_PASS
+
+    pi = subprocess.Popen(
+        command,
+        shell=True,
+        stdin=subprocess.PIPE,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        env=env,
+    )
     out, err = pi.communicate()
     logging.debug("output = %s" % out)
     logging.debug("stderr = %s" % err)


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

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

Reply via email to