From 87648f7bdf9a03b487882bc8412fdba29e51158b Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Tue, 3 May 2016 17:25:46 +0200 Subject: [PATCH] actionable.py: Do not print next task banner in handler callback (#15698) Fix actionable callback plugin to not print the banner of the previous task. When a handler is executed there is no task banner, so in case it is run, it will reference the banner from the preceding task. **Author:** @hvhaugwitz Test case: --- - name: actionable filter hosts: all handlers: - name: handler command: "true" tasks: - name: task 1 file: path=/tmp/test state=touch notify: handler - name: task 2 file: path=/tmp/test state=absent - name: task 3 file: path=/tmp/test state=absent - name: task 4 file: path=/tmp/test state=absent - name: task 5 file: path=/tmp/test state=absent - name: task 6 file: path=/tmp/test state=absent Example output: BEFORE ------ PLAY [actionable filter] ******************************************************* TASK [task 1] ****************************************************************** changed: [localhost] TASK [task 2] ****************************************************************** changed: [localhost] RUNNING HANDLER [handler] ****************************************************** TASK [task 6] ****************************************************************** changed: [localhost] PLAY RECAP ********************************************************************* localhost : ok=8 changed=3 unreachable=0 failed=0 AFTER ----- PLAY [actionable filter] ******************************************************* TASK [task 1] ****************************************************************** changed: [localhost] TASK [task 2] ****************************************************************** changed: [localhost] RUNNING HANDLER [handler] ****************************************************** changed: [localhost] PLAY RECAP ********************************************************************* localhost : ok=8 changed=3 unreachable=0 failed=0 --- lib/ansible/plugins/callback/actionable.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/plugins/callback/actionable.py b/lib/ansible/plugins/callback/actionable.py index 15bd8ca8353..8746d7579a3 100644 --- a/lib/ansible/plugins/callback/actionable.py +++ b/lib/ansible/plugins/callback/actionable.py @@ -33,6 +33,10 @@ class CallbackModule(CallbackModule_default): self.last_task = None self.shown_title = False + def v2_playbook_on_handler_task_start(self, task): + self.super_ref.v2_playbook_on_handler_task_start(task) + self.shown_title = True + def v2_playbook_on_task_start(self, task, is_conditional): self.last_task = task self.shown_title = False