mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 15:34:01 -07:00
issue callbacks per item and retry fails
- now workers passes queue to task_executor so it can send back events per item and on retry attempt - updated result class to pass along events to strategy - base strategy updated to forward new events to callback - callbacks now remove 'items' on final result but process them directly when invoked per item - new callback method to deal with retry attempt messages (also now obeys nolog) - updated tests to match new signature of task_executor fixes #14558 fixes #14072
This commit is contained in:
parent
6eb4633b07
commit
e02b98274b
7 changed files with 74 additions and 45 deletions
|
@ -172,16 +172,8 @@ class CallbackBase:
|
|||
return item
|
||||
|
||||
def _process_items(self, result):
|
||||
for res in result._result['results']:
|
||||
newres = self._copy_result_exclude(result, ['_result'])
|
||||
res['item'] = self._get_item(res)
|
||||
newres._result = res
|
||||
if 'failed' in res and res['failed']:
|
||||
self.v2_playbook_item_on_failed(newres)
|
||||
elif 'skipped' in res and res['skipped']:
|
||||
self.v2_playbook_item_on_skipped(newres)
|
||||
else:
|
||||
self.v2_playbook_item_on_ok(newres)
|
||||
# just remove them as now they get handled by individual callbacks
|
||||
del result._result['results']
|
||||
|
||||
def _clean_results(self, result, task_name):
|
||||
if 'changed' in result and task_name in ['debug']:
|
||||
|
@ -346,15 +338,6 @@ class CallbackBase:
|
|||
if 'diff' in result._result:
|
||||
self.on_file_diff(host, result._result['diff'])
|
||||
|
||||
def v2_playbook_on_item_ok(self, result):
|
||||
pass # no v1
|
||||
|
||||
def v2_playbook_on_item_failed(self, result):
|
||||
pass # no v1
|
||||
|
||||
def v2_playbook_on_item_skipped(self, result):
|
||||
pass # no v1
|
||||
|
||||
def v2_playbook_on_include(self, included_file):
|
||||
pass #no v1 correspondance
|
||||
|
||||
|
@ -366,3 +349,7 @@ class CallbackBase:
|
|||
|
||||
def v2_playbook_item_on_skipped(self, result):
|
||||
pass
|
||||
|
||||
def v2_playbook_retry(self, result):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue