callback: record handler tasks too

It turns out that we had been missing out on handler tasks because we
need to use the hook "v2_playbook_on_handler_task_start" for those.

Fixes: https://github.com/ansible-community/ara/issues/178
Change-Id: Id05ba581fb22eee26270c7f4bccc3445e87b5d3b
This commit is contained in:
David Moreau Simard 2020-09-30 22:15:55 -04:00
parent 853a073940
commit 40894c7027
No known key found for this signature in database
GPG Key ID: 7D4729EC4E64E8B7
3 changed files with 25 additions and 0 deletions

View File

@ -304,6 +304,11 @@ class CallbackModule(CallbackBase):
return self.play
def v2_playbook_on_handler_task_start(self, task):
self.log.debug("v2_playbook_on_handler_task_start")
# TODO: Why doesn't `v2_playbook_on_handler_task_start` have is_conditional ?
self.v2_playbook_on_task_start(task, False, handler=True)
def v2_playbook_on_task_start(self, task, is_conditional, handler=False):
self.log.debug("v2_playbook_on_task_start")
self._end_task()

View File

@ -0,0 +1,7 @@
# Copyright (c) 2020 The ARA Records Ansible authors
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- name: handler
debug:
msg: hi, this is a handler task
register: _handler_run

View File

@ -49,3 +49,16 @@
- name: Test for XSS
command: echo "<script>alert(document.cookie)</script>"
changed_when: False
- name: Notify something for a handler task
command: /bin/true
notify:
- handler
- name: Flush handlers
meta: flush_handlers
- name: Assert that handler task has run
assert:
that:
- _handler_run is success