mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Last loaded handler with the same name wins (#49249)
* Last loaded handler with the same name wins * Add comment explaining reversed
This commit is contained in:
parent
aee9209375
commit
c78c8d389f
2 changed files with 6 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Last loaded handler with the same name is used
|
|
@ -368,7 +368,8 @@ class StrategyBase:
|
||||||
return self._inventory.get_host(host_name)
|
return self._inventory.get_host(host_name)
|
||||||
|
|
||||||
def search_handler_blocks_by_name(handler_name, handler_blocks):
|
def search_handler_blocks_by_name(handler_name, handler_blocks):
|
||||||
for handler_block in handler_blocks:
|
# iterate in reversed order since last handler loaded with the same name wins
|
||||||
|
for handler_block in reversed(handler_blocks):
|
||||||
for handler_task in handler_block.block:
|
for handler_task in handler_block.block:
|
||||||
if handler_task.name:
|
if handler_task.name:
|
||||||
handler_vars = self._variable_manager.get_vars(play=iterator._play, task=handler_task)
|
handler_vars = self._variable_manager.get_vars(play=iterator._play, task=handler_task)
|
||||||
|
@ -394,7 +395,8 @@ class StrategyBase:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def search_handler_blocks_by_uuid(handler_uuid, handler_blocks):
|
def search_handler_blocks_by_uuid(handler_uuid, handler_blocks):
|
||||||
for handler_block in handler_blocks:
|
# iterate in reversed order since last handler loaded with the same name wins
|
||||||
|
for handler_block in reversed(handler_blocks):
|
||||||
for handler_task in handler_block.block:
|
for handler_task in handler_block.block:
|
||||||
if handler_uuid == handler_task._uuid:
|
if handler_uuid == handler_task._uuid:
|
||||||
return handler_task
|
return handler_task
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue