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>
pull/35926/head
Alex Tsitsimpis 7 years ago committed by Sam Doran
parent b7f4b89757
commit 933bc45cf2

@ -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

Loading…
Cancel
Save