mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 15:34:01 -07:00
Fixing the synchronize action plugin for v2
This commit is contained in:
parent
34aba2dd9a
commit
811a906332
2 changed files with 46 additions and 33 deletions
|
@ -73,7 +73,29 @@ class TaskExecutor:
|
|||
if items is not None:
|
||||
if len(items) > 0:
|
||||
item_results = self._run_loop(items)
|
||||
|
||||
# loop through the item results, and remember the changed/failed
|
||||
# result flags based on any item there.
|
||||
changed = False
|
||||
failed = False
|
||||
for item in item_results:
|
||||
if 'changed' in item:
|
||||
changed = True
|
||||
if 'failed' in item:
|
||||
failed = True
|
||||
|
||||
# create the overall result item, and set the changed/failed
|
||||
# flags there to reflect the overall result of the loop
|
||||
res = dict(results=item_results)
|
||||
|
||||
if changed:
|
||||
res['changed'] = True
|
||||
|
||||
if failed:
|
||||
res['failed'] = True
|
||||
res['msg'] = 'One or more items failed'
|
||||
else:
|
||||
res['msg'] = 'All items completed'
|
||||
else:
|
||||
res = dict(changed=False, skipped=True, skipped_reason='No items in the list', results=[])
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue