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:
parent
853a073940
commit
40894c7027
@ -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()
|
||||
|
7
tests/integration/roles/smoke-tests/handlers/main.yaml
Normal file
7
tests/integration/roles/smoke-tests/handlers/main.yaml
Normal 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
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user