mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix error where pod has error and no containers (#49154)
k8s: Fix error where pod has error and no containers
This commit is contained in:
committed by
John R Barker
parent
7190c73d50
commit
729c3a6767
@@ -236,6 +236,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable, K8sAnsibleM
|
|||||||
else:
|
else:
|
||||||
pod_labels = {}
|
pod_labels = {}
|
||||||
|
|
||||||
|
if not pod.status.containerStatuses:
|
||||||
|
continue
|
||||||
|
|
||||||
for container in pod.status.containerStatuses:
|
for container in pod.status.containerStatuses:
|
||||||
# add each pod_container to the namespace group, and to each label_value group
|
# add each pod_container to the namespace group, and to each label_value group
|
||||||
container_name = '{0}_{1}'.format(pod.metadata.name, container.name)
|
container_name = '{0}_{1}'.format(pod.metadata.name, container.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user