Merge "Record handler tasks in json job output"
This commit is contained in:
commit
533659fe0c
|
@ -1,6 +1,10 @@
|
||||||
- hosts: all
|
- hosts: all
|
||||||
|
handlers:
|
||||||
|
- name: handler
|
||||||
|
shell: echo "This is a handler"
|
||||||
tasks:
|
tasks:
|
||||||
- shell: echo "Standard output test {{ zuul.executor.src_root }}"
|
- shell: echo "Standard output test {{ zuul.executor.src_root }}"
|
||||||
|
notify: handler
|
||||||
- shell: echo "This should be skipped"
|
- shell: echo "This should be skipped"
|
||||||
when: false
|
when: false
|
||||||
- fail:
|
- fail:
|
||||||
|
|
|
@ -4926,6 +4926,10 @@ class TestJobOutput(AnsibleZuulTestCase):
|
||||||
['hosts']['localhost']['skipped'])
|
['hosts']['localhost']['skipped'])
|
||||||
self.assertTrue(j[0]['plays'][0]['tasks'][2]
|
self.assertTrue(j[0]['plays'][0]['tasks'][2]
|
||||||
['hosts']['localhost']['failed'])
|
['hosts']['localhost']['failed'])
|
||||||
|
self.assertEqual(
|
||||||
|
"This is a handler",
|
||||||
|
j[0]['plays'][0]['tasks'][3]
|
||||||
|
['hosts']['localhost']['stdout'])
|
||||||
|
|
||||||
self.log.info(self._get_file(self.history[0],
|
self.log.info(self._get_file(self.history[0],
|
||||||
'work/logs/job-output.txt'))
|
'work/logs/job-output.txt'))
|
||||||
|
|
|
@ -128,6 +128,9 @@ class CallbackModule(CallbackBase):
|
||||||
def v2_playbook_on_task_start(self, task, is_conditional):
|
def v2_playbook_on_task_start(self, task, is_conditional):
|
||||||
self.results[-1]['tasks'].append(self._new_task(task))
|
self.results[-1]['tasks'].append(self._new_task(task))
|
||||||
|
|
||||||
|
def v2_playbook_on_handler_task_start(self, task):
|
||||||
|
self.v2_playbook_on_task_start(task, False)
|
||||||
|
|
||||||
def v2_runner_on_ok(self, result, **kwargs):
|
def v2_runner_on_ok(self, result, **kwargs):
|
||||||
host = result._host
|
host = result._host
|
||||||
action = result._task.action
|
action = result._task.action
|
||||||
|
|
Loading…
Reference in New Issue