Ensure we don't overwrite handlers from include_role when loading a play. Fixes #18140 (#39563)

This commit is contained in:
Matt Martz 2018-05-01 12:18:36 -05:00 committed by GitHub
parent 5a6bdef76b
commit 6acdc36317
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -171,7 +171,11 @@ class Play(Base, Taggable, Become):
Bare handlers outside of a block are given an implicit block.
'''
try:
return load_list_of_blocks(ds=ds, play=self, use_handlers=True, variable_manager=self._variable_manager, loader=self._loader)
return self._extend_value(
self.handlers,
load_list_of_blocks(ds=ds, play=self, use_handlers=True, variable_manager=self._variable_manager, loader=self._loader),
prepend=True
)
except AssertionError as e:
raise AnsibleParserError("A malformed block was encountered while loading handlers", obj=self._ds, orig_exc=e)