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>
(cherry picked from commit a446dd4fce)
This commit is contained in:
Kevin Carter 2020-09-10 13:18:59 -05:00 committed by Emilien Macchi
parent f03177cc4b
commit 00fae36bcb
1 changed files with 1 additions and 1 deletions

View File

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