mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Fix the way handlers are compiled and found/notified
* Instead of rebuilding the handler list all over the place, we now compile the handlers at the point the play is post-validated so that the view of the play in the PlayIterator contains the definitive list * Assign the dep_chain to the handlers as they're compiling, just as we do for regular tasks * Clean up the logic used to find a given handler, which is greatly simplified by the above changes Fixes #15418
This commit is contained in:
parent
729686a434
commit
930d090507
4 changed files with 32 additions and 29 deletions
|
@ -122,10 +122,6 @@ class TaskQueueManager:
|
|||
inventory hostnames for those hosts triggering the handler.
|
||||
'''
|
||||
|
||||
handlers = play.handlers
|
||||
for role in play.roles:
|
||||
handlers.extend(role.get_handler_blocks())
|
||||
|
||||
# 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()
|
||||
|
@ -141,7 +137,7 @@ class TaskQueueManager:
|
|||
return temp_list
|
||||
|
||||
handler_list = []
|
||||
for handler_block in handlers:
|
||||
for handler_block in play.handlers:
|
||||
handler_list.extend(_process_block(handler_block))
|
||||
|
||||
# then initialize it with the given handler list
|
||||
|
@ -220,6 +216,7 @@ class TaskQueueManager:
|
|||
|
||||
new_play = play.copy()
|
||||
new_play.post_validate(templar)
|
||||
new_play.handlers = new_play.compile_roles_handlers() + new_play.handlers
|
||||
|
||||
self.hostvars = HostVars(
|
||||
inventory=self._inventory,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue