Last loaded handler with the same name wins (#49249)

* Last loaded handler with the same name wins

* Add comment explaining reversed
pull/48679/head
Martin Krizek 6 years ago committed by GitHub
parent aee9209375
commit c78c8d389f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
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:
if handler_task.name:
handler_vars = self._variable_manager.get_vars(play=iterator._play, task=handler_task)
@ -394,7 +395,8 @@ class StrategyBase:
return None
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:
if handler_uuid == handler_task._uuid:
return handler_task

Loading…
Cancel
Save