Fix error where pod has error and no containers

pull/49154/head
AlanCoding 6 years ago
parent 3433ca286d
commit 865430e3e0
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

@ -236,6 +236,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable, K8sAnsibleM
else:
pod_labels = {}
if not pod.status.containerStatuses:
continue
for container in pod.status.containerStatuses:
# add each pod_container to the namespace group, and to each label_value group
container_name = '{0}_{1}'.format(pod.metadata.name, container.name)

Loading…
Cancel
Save