Alex Lourie has uploaded a new change for review.

Change subject: packaging: Updated getEngineVersion functionality
......................................................................

packaging: Updated getEngineVersion functionality

If we use the getEngineVersion code on upgrades from
versions where the version file does not exist, we will
experience an error with opening the version file.

This patch tries to solve it by checking the presence of
the version file. If the file doesn't exist it will use
the getRpmVersion function to fetch the real version of
the engine package from the rpm.

Change-Id: I57c62cf64d0c44f824a8ec5071f2ef50ec97854e
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M packaging/fedora/setup/common_utils.py
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/11/12211/1

diff --git a/packaging/fedora/setup/common_utils.py 
b/packaging/fedora/setup/common_utils.py
index 841eed5..81a7bc6 100755
--- a/packaging/fedora/setup/common_utils.py
+++ b/packaging/fedora/setup/common_utils.py
@@ -1352,8 +1352,12 @@
 
 def getEngineVersion():
     # Just read the info from the file
-    with open(basedefs.FILE_ENGINE_VERSION) as version:
-        return version.readline().rstrip('\n')
+    # If the file doesn't exist (on first upgrades), read from rpm
+    if os.path.exists(basedefs.FILE_ENGINE_VERSION):
+        with open(basedefs.FILE_ENGINE_VERSION) as version:
+            return version.readline().rstrip('\n')
+    else:
+        return getRpmVersion()
 
 def installed(rpm):
     try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57c62cf64d0c44f824a8ec5071f2ef50ec97854e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <alou...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to