From 02d9336b320c39de652667069b7ecadd8ed36fc9 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Thu, 16 Feb 2023 16:30:23 +0100 Subject: Make using blocks as handlers a parser error (#79993) (#80010) Fixes #79968 (cherry picked from commit bd329dc54329a126056723311abd7442ed6a0389) --- lib/ansible/playbook/helpers.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index 444f571e99..38e32ef9a2 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -106,6 +106,8 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h raise AnsibleAssertionError('The ds (%s) should be a dict but was a %s' % (ds, type(ds))) if 'block' in task_ds: + if use_handlers: + raise AnsibleParserError("Using a block as a handler is not supported.", obj=task_ds) t = Block.load( task_ds, play=play, -- cgit v1.2.1