Fix incorrect msg in the results dict in loops (#71482)

This commit is contained in:
Martin Krizek 2020-08-27 21:49:53 +02:00 committed by GitHub
parent a1a624b150
commit 50f221c63e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 6 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Fix incorrect msg in the results dict in loops

View file

@ -145,7 +145,7 @@ class TaskExecutor:
res[array] = res[array] + item[array] res[array] = res[array] + item[array]
del item[array] del item[array]
if not res.get('Failed', False): if not res.get('failed', False):
res['msg'] = 'All items completed' res['msg'] = 'All items completed'
else: else:
res = dict(changed=False, skipped=True, skipped_reason='No items in the list', results=[]) res = dict(changed=False, skipped=True, skipped_reason='No items in the list', results=[])

View file

@ -33,7 +33,7 @@ ok: [testhost] => (item=debug-3) => {
"msg": "debug-3" "msg": "debug-3"
} }
skipping: [testhost] => (item=debug-4) skipping: [testhost] => (item=debug-4)
fatal: [testhost]: FAILED! => {"msg": "All items completed"} fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
...ignoring ...ignoring
TASK [EXPECTED FAILURE Failed task to be rescued] ****************************** TASK [EXPECTED FAILURE Failed task to be rescued] ******************************

View file

@ -1,5 +1,5 @@
+ ansible-playbook -i inventory test.yml + ansible-playbook -i inventory test.yml
++ set +x ++ set +x
fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"} fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
fatal: [testhost]: FAILED! => {"msg": "All items completed"} fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"} fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}

View file

@ -27,7 +27,7 @@ failed: [testhost] (item=debug-2) => {
"msg": "debug-2" "msg": "debug-2"
} }
skipping: [testhost] => (item=debug-4) skipping: [testhost] => (item=debug-4)
fatal: [testhost]: FAILED! => {"msg": "All items completed"} fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
...ignoring ...ignoring
TASK [EXPECTED FAILURE Failed task to be rescued] ****************************** TASK [EXPECTED FAILURE Failed task to be rescued] ******************************

View file

@ -29,7 +29,7 @@ failed: [testhost] (item=debug-2) => {
ok: [testhost] => (item=debug-3) => { ok: [testhost] => (item=debug-3) => {
"msg": "debug-3" "msg": "debug-3"
} }
fatal: [testhost]: FAILED! => {"msg": "All items completed"} fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
...ignoring ...ignoring
TASK [EXPECTED FAILURE Failed task to be rescued] ****************************** TASK [EXPECTED FAILURE Failed task to be rescued] ******************************

View file

@ -23,7 +23,7 @@ changed: [testhost] => (item=debug-1) => {
failed: [testhost] (item=debug-2) => { failed: [testhost] (item=debug-2) => {
"msg": "debug-2" "msg": "debug-2"
} }
fatal: [testhost]: FAILED! => {"msg": "All items completed"} fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
...ignoring ...ignoring
TASK [EXPECTED FAILURE Failed task to be rescued] ****************************** TASK [EXPECTED FAILURE Failed task to be rescued] ******************************