diff --git a/contrib/kubespray/script/openpai-generator.py b/contrib/kubespray/script/openpai-generator.py index c60c218ee..e8262f667 100644 --- a/contrib/kubespray/script/openpai-generator.py +++ b/contrib/kubespray/script/openpai-generator.py @@ -106,16 +106,20 @@ def pod_is_ready_or_not(label_key, label_value, service_name): for pod in pod_list.items: if pod.status.container_statuses is None: unready = unready + 1 + continue + flag = True for container in pod.status.container_statuses: if container.ready != True: unready = unready + 1 - else: - ready = ready + 1 + flag = False + break + if flag: + ready = ready + 1 if unready != 0: logger.info("{0} is not ready.".format(service_name)) logger.info("Total: {0}".format(ready + unready)) - logger.info("Ready: {1}",format(ready)) + logger.info("Ready: {0}".format(ready)) return False return True