Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: changed psql parser in 
engine-upgrade.getCompensations
......................................................................

packaging: changed psql parser in engine-upgrade.getCompensations

In engine-upgrade getCompensations previously parsed the output
of psql searching for "0 rows" as flag for "no records found" and
failed on locale like Italian where it is "0 righe".
Now the parser doesn't rely on a localized string for detecting an
empty set.

Change-Id: I397d609fce6826e02b0f409e81228fe7d9d7be0a
Bug-Url: https://bugzilla.redhat.com/912426
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/fedora/setup/engine-upgrade.py
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/20/12220/1

diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index 6cd55a2..629c171 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -845,7 +845,10 @@
         return ""
 
 def getCompensations(dbName=basedefs.DB_NAME):
-    # Get compensations
+    """
+    Get compensations.
+    Returns an empty string if there are no compensations.
+    """
     compensations, rc = utils.execRemoteSqlCommand(
                                        userName=SERVER_ADMIN,
                                        dbHost=SERVER_NAME,
@@ -858,7 +861,8 @@
 
     # We only want to return anything if there are really compensations records
     if not compensations or \
-       (compensations and "0 rows" in compensations):
+       (compensations and len(compensations.split("\n")) <= 5):
+        # An empty set has 5 rows: column names, -+- , "0 rows", 2 empty lines
         return ""
     else:
         return compensations


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

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

Reply via email to