Alex Lourie has uploaded a new change for review.

Change subject: packaging: updated setup to fail immediately if adding host 
fails
......................................................................

packaging: updated setup to fail immediately if adding host fails

* Updated retry() function in utils to recieve an Exception()
parameter that will not be ignored.
* Updated host status check with the additional Exception() that
if raised will fail the setup.

Change-Id: I404af2b1702dbe5881cbd60d06a1b976b7a651a7
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M packaging/fedora/setup/common_utils.py
M packaging/fedora/setup/plugins/all_in_one_100.py
2 files changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/78/10578/1

diff --git a/packaging/fedora/setup/common_utils.py 
b/packaging/fedora/setup/common_utils.py
index 2507d28..0f018b8 100755
--- a/packaging/fedora/setup/common_utils.py
+++ b/packaging/fedora/setup/common_utils.py
@@ -966,7 +966,7 @@
     else:
         return askYesNo(question)
 
-def retry(func, expectedException=Exception, tries=None, timeout=None, 
sleep=1):
+def retry(func, expectedException=Exception, failOnException=None, tries=None, 
timeout=None, sleep=1):
     """
     Retry a function. Wraps the retry logic so you don't have to
     implement it each time you need it.
@@ -990,7 +990,11 @@
         tries -= 1
         try:
             return func()
-        except expectedException:
+        except expectedException as e:
+
+            if failOnException and e.message == failOnException.message:
+                raise failOnException
+
             if tries == 0:
                 raise
 
diff --git a/packaging/fedora/setup/plugins/all_in_one_100.py 
b/packaging/fedora/setup/plugins/all_in_one_100.py
index 7680b3b..00d9d4a 100644
--- a/packaging/fedora/setup/plugins/all_in_one_100.py
+++ b/packaging/fedora/setup/plugins/all_in_one_100.py
@@ -270,7 +270,7 @@
 
 def waitForHostUp():
     # We will wait for 10 minutes for host to start. We sample the status each 
5 seconds.
-    utils.retry(isHostUp, tries=120, timeout=600, sleep=5)
+    utils.retry(isHostUp, failOnException=Exception(ERROR_CREATE_HOST_FAILED), 
tries=120, timeout=600, sleep=5)
 
 def isHostUp():
     logging.debug("Waiting for host to become operational")


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I404af2b1702dbe5881cbd60d06a1b976b7a651a7
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