[READINESS] Update readiness script
Changes on ready.py:
* rename wrong variable name
* stop if the container job is terminated
Issue-ID: OOM-2878
Signed-off-by: othman touijer <othman.touijer@soprasteria.com>
Change-Id: I5b2617ecdf39a59f7d22f3c0d4cc507801d7bc56
diff --git a/ready.py b/ready.py
index 9055950..4eb73ab 100755
--- a/ready.py
+++ b/ready.py
@@ -228,14 +228,11 @@
name = read_name(item)
log.info("Container Details %s ", container)
log.info("Container Status %s ", container.state.terminated)
- if container.state.terminated is None:
- continue
- log.info("Container Status Reason %s ", container.state.terminated.reason)
- if container.state.terminated.reason == 'Completed':
- complete = True
- log.info("%s is complete", container_name)
- else:
- log.info("%s is NOT complete", container_name)
+
+ if container.state.terminated:
+ log.info("Container Terminated with reason %s ", container.state.terminated.reason)
+ complete = True
+
except ApiException as exc:
log.error("Exception when calling read_namespaced_job_status: %s\n",
exc)
@@ -380,7 +377,7 @@
break
if time.time() > timeout:
log.warning("timed out waiting for '%s' to be ready",
- job_name)
+ service_mesh_job_container_name)
sys.exit(1)
else:
# spread in time potentially parallel execution in multiple