Skip to content

Commit 5526334

Browse files
committed
more careful printing of pod status in case containerStatuses == None
1 parent c724975 commit 5526334

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/containers/kubernetes_utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,13 @@ def ready() -> bool:
280280
pod: ResourceField
281281
for pod in pods:
282282
if not Readiness.is_pod_ready(pod) and not Readiness.is_pod_succeeded(pod):
283+
if not pod.status.containerStatuses:
284+
pod_status = pod.status
285+
else:
286+
pod_status = {cs.name: cs.state for cs in pod.status.containerStatuses}
287+
283288
logging.debug("Pod is not ready: %s/%s (%s)",
284-
namespace_name, pod.metadata.name,
285-
{cs.name: cs.state for cs in pod.status.containerStatuses})
289+
namespace_name, pod.metadata.name, pod_status)
286290
return False
287291
else:
288292
# check all containers in pods are ready

0 commit comments

Comments
 (0)