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

Change subject: packaging: misc cleanups related to pgpass
......................................................................

packaging: misc cleanups related to pgpass

Change-Id: Iadef87a2a0a7b93f3d3533b6daf411bb8397af82
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/fedora/setup/common_utils.py
M packaging/fedora/setup/engine-upgrade.py
2 files changed, 27 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/8348/1

diff --git a/packaging/fedora/setup/common_utils.py 
b/packaging/fedora/setup/common_utils.py
index 27e3a70..5b8db8c 100755
--- a/packaging/fedora/setup/common_utils.py
+++ b/packaging/fedora/setup/common_utils.py
@@ -658,9 +658,9 @@
 
     inDbAdminSection = False
     inDbUserSection = False
-    if (os.path.exists(basedefs.DB_PASS_FILE)):
-        logging.debug("found existing pgpass file, fetching DB %s value" % 
param)
-        with open (basedefs.DB_PASS_FILE) as pgPassFile:
+    if os.path.exists(basedefs.DB_PASS_FILE):
+        logging.debug("found existing pgpass file '%s', fetching DB %s value" 
% (basedefs.DB_PASS_FILE, param))
+        with open(basedefs.DB_PASS_FILE) as pgPassFile:
             for line in pgPassFile:
 
                 # find the line with "DB ADMIN"
@@ -668,16 +668,21 @@
                     inDbAdminSection = True
                     continue
 
-                if inDbAdminSection and param == "admin" and \
-                   not line.startswith("#"):
+                if (
+                    inDbAdminSection and
+                    param == "admin" and
+                    not line.startswith("#")
+                ):
                     # Means we're on DB ADMIN line, as it's for all DBs
                     dbcreds = line.split(":", 4)
                     return dbcreds[field[param]]
 
                 # Fetch the password if needed
-                if param == "password" \
-                   and user \
-                   and not line.startswith("#"):
+                if (
+                    param == "password" and
+                    user and
+                    not line.startswith("#")
+                ):
                     dbcreds = line.split(":", 4)
                     if dbcreds[3] == user:
                         return dbcreds[field[param]]
diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index c7c46b2..4f13934 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -797,23 +797,23 @@
     """
     queryCheckDCVersions="SELECT compatibility_version FROM storage_pool;"
     dcVersions, rc = utils.execRemoteSqlCommand(
-        SERVER_ADMIN,
-        SERVER_NAME,
-        SERVER_PORT,
-        basedefs.DB_NAME,
-        queryCheckDCVersions,
-        True,
-        MSG_ERROR_CONNECT_DB,
+        userName=SERVER_ADMIN,
+        dbHost=SERVER_NAME,
+        dbPort=SERVER_PORT,
+        dbName=basedefs.DB_NAME,
+        sqlQuery=queryCheckDCVersions,
+        failOnError=True,
+        errMsg=MSG_ERROR_CONNECT_DB,
     )
     queryCheckClusterVersions="SELECT compatibility_version FROM vds_groups;"
     clusterVersions, rc = utils.execRemoteSqlCommand(
-        SERVER_ADMIN,
-        SERVER_NAME,
-        SERVER_PORT,
-        basedefs.DB_NAME,
-        queryCheckClusterVersions,
-        True,
-        MSG_ERROR_CONNECT_DB
+        userName=SERVER_ADMIN,
+        dbHost=SERVER_NAME,
+        dbPort=SERVER_PORT,
+        dbName=basedefs.DB_NAME,
+        sqlQuery=queryCheckClusterVersions,
+        failOnError=True,
+        errMsg=MSG_ERROR_CONNECT_DB,
     )
 
     for versions in dcVersions, clusterVersions:


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

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

Reply via email to