From d5ed818e7cbf911e00a449caac47959ae0d7299d Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 29 Aug 2018 15:05:55 -0500 Subject: [PATCH] Make sure we skip handlers from includes in compile_roles_handlers. Fixes #44848 (#44852) --- changelogs/fragments/include-double-handler.yaml | 2 ++ lib/ansible/playbook/play.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/include-double-handler.yaml diff --git a/changelogs/fragments/include-double-handler.yaml b/changelogs/fragments/include-double-handler.yaml new file mode 100644 index 0000000000..96b4836a18 --- /dev/null +++ b/changelogs/fragments/include-double-handler.yaml @@ -0,0 +1,2 @@ +bugfixes: +- includes - ensure we do not double register handlers from includes to prevent exception (https://github.com/ansible/ansible/issues/44848) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 4437207405..9d519a1b95 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -239,6 +239,8 @@ class Play(Base, Taggable, Become): if len(self.roles) > 0: for r in self.roles: + if r.from_include: + continue block_list.extend(r.get_handler_blocks(play=self)) return block_list