Support list of dicts with omit. Fixes #45907 (#45923)

This commit is contained in:
Matt Martz 2018-11-07 13:41:22 -06:00 committed by GitHub
parent 17b3171917
commit 0d068f1e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View file

@ -42,13 +42,18 @@ def remove_omit(task_args, omit_token):
Remove args with a value equal to the ``omit_token`` recursively
to align with now having suboptions in the argument_spec
'''
new_args = {}
if not isinstance(task_args, dict):
return task_args
new_args = {}
for i in iteritems(task_args):
if i[1] == omit_token:
continue
elif isinstance(i[1], dict):
new_args[i[0]] = remove_omit(i[1], omit_token)
elif isinstance(i[1], list):
new_args[i[0]] = [remove_omit(v, omit_token) for v in i[1]]
else:
new_args[i[0]] = i[1]