mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
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:
committed by
Jordan Borean
parent
b1a9e7b8c8
commit
be9f07279e
@@ -458,9 +458,6 @@ class StrategyBase:
|
||||
else:
|
||||
iterator.mark_host_failed(original_host)
|
||||
|
||||
# increment the failed count for this host
|
||||
self._tqm._stats.increment('failures', original_host.name)
|
||||
|
||||
# grab the current state and if we're iterating on the rescue portion
|
||||
# of a block then we save the failed task in a special var for use
|
||||
# within the rescue/always
|
||||
@@ -470,6 +467,7 @@ class StrategyBase:
|
||||
self._tqm._failed_hosts[original_host.name] = True
|
||||
|
||||
if state and iterator.get_active_state(state).run_state == iterator.ITERATING_RESCUE:
|
||||
self._tqm._stats.increment('rescued', original_host.name)
|
||||
self._variable_manager.set_nonpersistent_facts(
|
||||
original_host,
|
||||
dict(
|
||||
@@ -477,8 +475,11 @@ class StrategyBase:
|
||||
ansible_failed_result=task_result._result,
|
||||
),
|
||||
)
|
||||
else:
|
||||
self._tqm._stats.increment('failures', original_host.name)
|
||||
else:
|
||||
self._tqm._stats.increment('ok', original_host.name)
|
||||
self._tqm._stats.increment('ignored', original_host.name)
|
||||
if 'changed' in task_result._result and task_result._result['changed']:
|
||||
self._tqm._stats.increment('changed', original_host.name)
|
||||
self._tqm.send_callback('v2_runner_on_failed', task_result, ignore_errors=ignore_errors)
|
||||
|
||||
Reference in New Issue
Block a user