Add guard to ensure a mapping has a valid key

This change will ensure our list comprehension doesn't
fault when attempting to perform a "containers" lookup
against a given resultant. While the result object
should always have a "containers" we've seen intermitent
failures in CI pointing at this being an issue.

Change-Id: I8f22888ba473c78dd56988546ae402ca41c8b89f
Closes-Bug: #1886636
Signed-off-by: Kevin Carter <kecarter@redhat.com>
changes/74/751074/1
Kevin Carter 2 years ago
parent 325d080583
commit a446dd4fce
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
  1. 2
      tripleo_ansible/ansible_plugins/action/container_status.py

@ -206,7 +206,7 @@ class ActionModule(ActionBase):
module_args=dict(name=containers),
task_vars=tvars
)
return [c for c in result["containers"]]
return [c for c in result["containers"] if "containers" in result]
@tenacity.retry(
reraise=True,

Loading…
Cancel
Save