Fix "Set failed, unreachable, skipped statuses in json plugin"

This change was ineffective because it was modifying the wrong data.
Correct that and add a test.

Change-Id: I26cfba0ff9a3eca05314e12f3f1d66b934c505b6
This commit is contained in:
James E. Blair
2019-09-04 13:13:41 -07:00
parent 90b1add80a
commit cfe6a7b985
3 changed files with 14 additions and 2 deletions

View File

@@ -158,11 +158,13 @@ class CallbackModule(CallbackBase):
def v2_runner_on_failed(self, result, **kwargs):
self.v2_runner_on_ok(result, **kwargs)
result._host.setdefault('failed', True)
self.results[-1]['tasks'][-1]['hosts'][result._host.name].\
setdefault('failed', True)
def v2_runner_on_skipped(self, result, **kwargs):
self.v2_runner_on_ok(result, **kwargs)
result._host.setdefault('skipped', True)
self.results[-1]['tasks'][-1]['hosts'][result._host.name].\
setdefault('skipped', True)
def v2_playbook_on_stats(self, stats):
"""Display info about playbook statistics"""