mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make it an error to try to hit a change handler that doesn't exist
This commit is contained in:
parent
f693759252
commit
35d77d0433
1 changed files with 4 additions and 0 deletions
|
@ -338,16 +338,20 @@ class PlayBook(object):
|
|||
# for all registered handlers in the ansible playbook
|
||||
# for this particular pattern group
|
||||
|
||||
found = False
|
||||
for x in handlers:
|
||||
name = x.get('name', None)
|
||||
if name is None:
|
||||
raise errors.AnsibleError('handler is missing a name')
|
||||
if match_name == name:
|
||||
found = True
|
||||
self.callbacks.on_notify(host, name)
|
||||
# flag the handler with the list of hosts it needs to be run on, it will be run later
|
||||
if not 'run' in x:
|
||||
x['run'] = []
|
||||
x['run'].append(host)
|
||||
if not found:
|
||||
raise errors.AnsibleError("change handler (%s) is not defined" % match_name)
|
||||
|
||||
# *****************************************************
|
||||
|
||||
|
|
Loading…
Reference in a new issue