Add stats on rescued/ignored tasks (#48418)

* Adding rescued/ignored tasks to stats gathering

Fixes #31245

* Amend integration tests to pass

* callback/dense.py: fix too-many-format-args

* Add changelog

* Amend counter_enabled and unixy callbacks

* Fix syntax error

* Fix typo in the changelog

* Remove not needed comment

* Re-add skipped

* Add test for rescued

* Fix colors...

* Fix unstable tests?

* Add a note to the porting guide

* Re-word the note in the porting guide

Fixes #20346
Fixes #24525
Fixes #14393

Co-authored-by: James Cammarata <jimi@sngx.net>
Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
This commit is contained in:
Martin Krizek
2019-02-20 04:00:47 +01:00
committed by Jordan Borean
parent b1a9e7b8c8
commit be9f07279e
17 changed files with 107 additions and 41 deletions

View File

@@ -22,6 +22,12 @@ changed: [testhost] => (item=foo-1)
changed: [testhost] => (item=foo-2)
changed: [testhost] => (item=foo-3)
TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
TASK [Rescue task] *************************************************************
changed: [testhost]
RUNNING HANDLER [Test handler 1] ***********************************************
changed: [testhost]
@@ -40,5 +46,5 @@ TASK [Second free task] ********************************************************
changed: [testhost]
PLAY RECAP *********************************************************************
testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=1
testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=1 rescued=1 ignored=1

View File

@@ -1,3 +1,4 @@
+ ansible-playbook -i inventory test.yml
++ set +x
fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}

View File

@@ -21,6 +21,11 @@ changed: [testhost] => (item=foo-1)
changed: [testhost] => (item=foo-2)
changed: [testhost] => (item=foo-3)
TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
TASK [Rescue task] *************************************************************
changed: [testhost]
RUNNING HANDLER [Test handler 1] ***********************************************
changed: [testhost]
@@ -39,5 +44,5 @@ TASK [Second free task] ********************************************************
changed: [testhost]
PLAY RECAP *********************************************************************
testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=1
testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=1 rescued=1 ignored=1

View File

@@ -19,6 +19,12 @@ changed: [testhost] => (item=foo-1)
changed: [testhost] => (item=foo-2)
changed: [testhost] => (item=foo-3)
TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
TASK [Rescue task] *************************************************************
changed: [testhost]
RUNNING HANDLER [Test handler 1] ***********************************************
changed: [testhost]
@@ -34,5 +40,5 @@ TASK [Second free task] ********************************************************
changed: [testhost]
PLAY RECAP *********************************************************************
testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=1
testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=1 rescued=1 ignored=1

View File

@@ -19,6 +19,12 @@ changed: [testhost] => (item=foo-1)
changed: [testhost] => (item=foo-2)
changed: [testhost] => (item=foo-3)
TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
TASK [Rescue task] *************************************************************
changed: [testhost]
RUNNING HANDLER [Test handler 1] ***********************************************
changed: [testhost]
@@ -37,5 +43,5 @@ TASK [Second free task] ********************************************************
changed: [testhost]
PLAY RECAP *********************************************************************
testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=1
testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=1 rescued=1 ignored=1

View File

@@ -16,6 +16,12 @@ changed: [testhost] => (item=foo-1)
changed: [testhost] => (item=foo-2)
changed: [testhost] => (item=foo-3)
TASK [EXPECTED FAILURE Failed task to be rescued] ******************************
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
TASK [Rescue task] *************************************************************
changed: [testhost]
RUNNING HANDLER [Test handler 1] ***********************************************
changed: [testhost]
@@ -31,5 +37,5 @@ TASK [Second free task] ********************************************************
changed: [testhost]
PLAY RECAP *********************************************************************
testhost : ok=10 changed=7 unreachable=0 failed=0 skipped=1
testhost : ok=11 changed=8 unreachable=0 failed=0 skipped=1 rescued=1 ignored=1

View File

@@ -33,6 +33,14 @@
- 3
loop_control:
label: foo-{{ item }}
- block:
- name: EXPECTED FAILURE Failed task to be rescued
fail:
rescue:
- name: Rescue task
command: echo rescued
handlers:
- name: Test handler 1
command: echo foo