mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Consolidate handler tracking (#49338)
* Consolidate handler tracking - Remove unused code. ci_complete - unit test fixes. ci_complete - Restore previous behavior of matching a single handler - when notifying a host for a handler, return True if it was added, False otherwise, to reduce copied logic - rename funcitons for clarity. ci_complete - Remove handler logic for static includes which was disabled previously
This commit is contained in:
parent
62b2a08cfb
commit
2a469fd959
7 changed files with 41 additions and 133 deletions
|
@ -90,10 +90,6 @@ class TaskQueueManager:
|
|||
# a special flag to help us exit cleanly
|
||||
self._terminated = False
|
||||
|
||||
# this dictionary is used to keep track of notified handlers
|
||||
self._notified_handlers = dict()
|
||||
self._listening_handlers = dict()
|
||||
|
||||
# dictionaries to keep track of failed/unreachable hosts
|
||||
self._failed_hosts = dict()
|
||||
self._unreachable_hosts = dict()
|
||||
|
@ -120,11 +116,6 @@ class TaskQueueManager:
|
|||
inventory hostnames for those hosts triggering the handler.
|
||||
'''
|
||||
|
||||
# Zero the dictionary first by removing any entries there.
|
||||
# Proxied dicts don't support iteritems, so we have to use keys()
|
||||
self._notified_handlers.clear()
|
||||
self._listening_handlers.clear()
|
||||
|
||||
def _process_block(b):
|
||||
temp_list = []
|
||||
for t in b.block:
|
||||
|
@ -137,23 +128,6 @@ class TaskQueueManager:
|
|||
handler_list = []
|
||||
for handler_block in play.handlers:
|
||||
handler_list.extend(_process_block(handler_block))
|
||||
# then initialize it with the given handler list
|
||||
self.update_handler_list(handler_list)
|
||||
|
||||
def update_handler_list(self, handler_list):
|
||||
for handler in handler_list:
|
||||
if handler._uuid not in self._notified_handlers:
|
||||
display.debug("Adding handler %s to notified list" % handler.name)
|
||||
self._notified_handlers[handler._uuid] = []
|
||||
if handler.listen:
|
||||
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] = []
|
||||
display.debug("Adding handler %s to listening list" % handler.name)
|
||||
self._listening_handlers[listener].append(handler._uuid)
|
||||
|
||||
def load_callbacks(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue