From: BorislavG Date: Wed, 14 Feb 2018 13:23:51 +0000 (+0200) Subject: Fix readiness-check exception X-Git-Tag: 2.0.0-ONAP~455 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=07dc7db266ecfb88a783a94fac5c54e2092bda53;p=oom.git Fix readiness-check exception The problem is that the script tried to iterate on statuses of pod containers. when some pod is in state "pending" or some other case when there is no status, the statuses is None. Therefore python throws exception when trying to iterate None, which is non-iterable. Issue-ID: OOM-514 Signed-off-by: BorislavG Change-Id: If57b8a632a83489fddb12373e4047396f5fa08a3 --- diff --git a/kubernetes/readiness/docker/init/ready.py b/kubernetes/readiness/docker/init/ready.py index c5b55eef18..7cfb6cdcde 100644 --- a/kubernetes/readiness/docker/init/ready.py +++ b/kubernetes/readiness/docker/init/ready.py @@ -36,6 +36,9 @@ def is_ready(container_name): try: response = v1.list_namespaced_pod(namespace=namespace, watch=False) for i in response.items: + # container_statuses can be None, which is non-iterable. + if i.status.container_statuses is None: + continue for s in i.status.container_statuses: if s.name == container_name: ready = s.ready