[node-patches] Change in ovirt-node[ovirt-3.5]: ovirt-node-upgrade: set ret statement correctly

fabiand at redhat.com fabiand at redhat.com
Wed May 6 15:47:39 UTC 2015


Fabian Deutsch has uploaded a new change for review.

Change subject: ovirt-node-upgrade: set ret statement correctly
......................................................................

ovirt-node-upgrade: set ret statement correctly

Move the ret statement equals 0 (non error) when upgrade action is
executed sucessfully instead of call it on the finally clause which
might hide real issues on tools outside ovirt-node-upgrade.

Change-Id: Ia18a7d3b27c01001d47f8a91c59dc33d218f0c57
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1182089
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
(cherry picked from commit 8f25a30a1572e42ec2b7ffba27f5afe4df3e9ad5)
---
M scripts/ovirt-node-upgrade.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/18/40618/1

diff --git a/scripts/ovirt-node-upgrade.py b/scripts/ovirt-node-upgrade.py
index 6b8614d..6b610bb 100755
--- a/scripts/ovirt-node-upgrade.py
+++ b/scripts/ovirt-node-upgrade.py
@@ -358,6 +358,8 @@
             elif not os.path.exists(self._options.iso_file):
                 raise RuntimeError("%s does not exist" %
                                    self._options.iso_file)
+
+            ret = 1
             try:
                 self._extract_rootfs(self._options.iso_file)
                 self._run_hooks("pre-upgrade")
@@ -366,14 +368,13 @@
                 if self._options.reboot > 0:
                     self._reboot(self._options.reboot)
                 self._logger.info("Upgrade Completed")
+                ret = 0
             except Exception as e:
                 self._logger.exception('Error: Upgrade Failed: %s', e)
                 self._run_hooks("rollback")
                 self._logger.info("Upgrade Failed, Rollback Completed")
-                ret = 1
             finally:
                 self._cleanup()
-                ret = 0
             sys.exit(ret)
 
 if __name__ == "__main__":


-- 
To view, visit https://gerrit.ovirt.org/40618
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia18a7d3b27c01001d47f8a91c59dc33d218f0c57
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list