Fix error where pod has error and no containers
(cherry picked from commit 865430e3e0
)
This commit is contained in:
parent
aa1b00f7e9
commit
fb39299578
2 changed files with 7 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
bugfixes:
|
||||
- Convert hostvars data in OpenShift inventory plugin to be serializable by ansible-inventory
|
||||
- Fix error in OpenShift inventory plugin when a pod has errored and is empty
|
|
@ -127,6 +127,9 @@ class K8sInventoryHelper(K8sAnsibleMixin):
|
|||
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…
Reference in a new issue