From a66fc4189504e0218bf571bba742e58b10233693 Mon Sep 17 00:00:00 2001 From: Brandon Squizzato <35474886+bsquizz@users.noreply.github.com> Date: Wed, 13 Oct 2021 21:39:30 -0400 Subject: [PATCH] Make sure that CJI timeout results in exit (#135) --- bonfire/openshift.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bonfire/openshift.py b/bonfire/openshift.py index ed4f2519..fb9d9f05 100644 --- a/bonfire/openshift.py +++ b/bonfire/openshift.py @@ -421,7 +421,7 @@ def _check_with_periodic_log(self): self._time_last_logged = time.time() return False - def wait_for_ready(self, timeout): + def wait_for_ready(self, timeout, reraise=False): self._time_last_logged = time.time() self._time_remaining = timeout @@ -439,8 +439,12 @@ def wait_for_ready(self, timeout): return True except (StatusError, ErrorReturnCode) as err: log.error("[%s] hit error waiting for resource to be ready: %s", self.key, str(err)) + if reraise: + raise except (TimeoutException, TimedOutError): log.error("[%s] timed out waiting for resource to be ready", self.key) + if reraise: + raise return False @@ -728,7 +732,7 @@ def _pod_found(): remaining_time = remaining_time - elapsed waiter = ResourceWaiter(namespace, "pod", pod_name) - waiter.wait_for_ready(remaining_time) + waiter.wait_for_ready(remaining_time, reraise=True) return pod_name