1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

callback: Get handlers with json callback plugin (#35842)

Implement the `v2_playbook_on_handler_task_start()' method in the json
callback plugin to correctly include handlers in the results.

This fixes a bug where the last task in the results returned by
json callback would be wrong if an unconditional handler was triggered,
since the result of that handler would overwrite the result of the last
task.

Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
This commit is contained in:
Alex Tsitsimpis 2018-02-08 23:01:32 +02:00 committed by Sam Doran
parent b7f4b89757
commit 933bc45cf2

View file

@ -55,6 +55,9 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_task_start(self, task, is_conditional):
self.results[-1]['tasks'].append(self._new_task(task))
def v2_playbook_on_handler_task_start(self, task):
self.results[-1]['tasks'].append(self._new_task(task))
def v2_runner_on_ok(self, result, **kwargs):
host = result._host
self.results[-1]['tasks'][-1]['hosts'][host.name] = result._result