mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
make changed filter understand results lists
This commit is contained in:
parent
e5d45311f9
commit
c4d20094b4
1 changed files with 10 additions and 1 deletions
|
@ -54,7 +54,16 @@ def changed(*a, **kw):
|
||||||
item = a[0]
|
item = a[0]
|
||||||
if type(item) != dict:
|
if type(item) != dict:
|
||||||
raise errors.AnsibleFilterError("|changed expects a dictionary")
|
raise errors.AnsibleFilterError("|changed expects a dictionary")
|
||||||
return item.get('changed', False)
|
if not 'changed' in item:
|
||||||
|
changed = False
|
||||||
|
if ('results' in item # some modules return a 'results' key
|
||||||
|
and type(item['results']) == list
|
||||||
|
and type(item['results'][0]) == dict):
|
||||||
|
for result in item['results']:
|
||||||
|
changed = changed or result.get('changed', False)
|
||||||
|
else:
|
||||||
|
changed = item.get('changed', False)
|
||||||
|
return changed
|
||||||
|
|
||||||
def skipped(*a, **kw):
|
def skipped(*a, **kw):
|
||||||
''' Test if task result yields skipped '''
|
''' Test if task result yields skipped '''
|
||||||
|
|
Loading…
Reference in a new issue