From 15e648dd94e67e26b78d242414059f4dfc4e66fa Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 21 Jun 2016 10:00:10 -0500 Subject: [PATCH] Fix handler listeners as a list The listen statement on handlers should have supported a list, however it was broken in the revision of the pub/sub feature based on the handler revamp. This patch corrects the bug, so this works again: - name: some handler ... listen: - some target - another target Fixes #16378 --- lib/ansible/executor/task_queue_manager.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index 10f3b50d4be..25c3469d385 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -149,9 +149,13 @@ class TaskQueueManager: if handler not in self._notified_handlers: self._notified_handlers[handler] = [] if handler.listen: - if handler.listen not in self._listening_handlers: - self._listening_handlers[handler.listen] = [] - self._listening_handlers[handler.listen].append(handler.get_name()) + listeners = handler.listen + if not isinstance(listeners, list): + listeners = [ listeners ] + for listener in listeners: + if listener not in self._listening_handlers: + self._listening_handlers[listener] = [] + self._listening_handlers[listener].append(handler.get_name()) def load_callbacks(self): '''