Merge "Record handler tasks in json job output"

This commit is contained in:
Zuul 2019-09-10 20:38:16 +00:00 committed by Gerrit Code Review
commit 533659fe0c
3 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,10 @@
- hosts: all
handlers:
- name: handler
shell: echo "This is a handler"
tasks:
- shell: echo "Standard output test {{ zuul.executor.src_root }}"
notify: handler
- shell: echo "This should be skipped"
when: false
- fail:

View File

@ -4926,6 +4926,10 @@ class TestJobOutput(AnsibleZuulTestCase):
['hosts']['localhost']['skipped'])
self.assertTrue(j[0]['plays'][0]['tasks'][2]
['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],
'work/logs/job-output.txt'))

View File

@ -128,6 +128,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.v2_playbook_on_task_start(task, False)
def v2_runner_on_ok(self, result, **kwargs):
host = result._host
action = result._task.action