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>
This commit is contained in:
Kevin Carter 2020-09-10 13:18:59 -05:00
parent 325d080583
commit a446dd4fce
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A

View File

@ -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,