Commit 35d77d04 by Michael DeHaan

Make it an error to try to hit a change handler that doesn't exist

parent f6937592
...@@ -338,16 +338,20 @@ class PlayBook(object): ...@@ -338,16 +338,20 @@ class PlayBook(object):
# for all registered handlers in the ansible playbook # for all registered handlers in the ansible playbook
# for this particular pattern group # for this particular pattern group
found = False
for x in handlers: for x in handlers:
name = x.get('name', None) name = x.get('name', None)
if name is None: if name is None:
raise errors.AnsibleError('handler is missing a name') raise errors.AnsibleError('handler is missing a name')
if match_name == name: if match_name == name:
found = True
self.callbacks.on_notify(host, name) 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 # flag the handler with the list of hosts it needs to be run on, it will be run later
if not 'run' in x: if not 'run' in x:
x['run'] = [] x['run'] = []
x['run'].append(host) x['run'].append(host)
if not found:
raise errors.AnsibleError("change handler (%s) is not defined" % match_name)
# ***************************************************** # *****************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment