mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
Plays and tasks now yell when they see parameters they do not understand, so that typos like 'var' for 'vars'
don't result in people having to ask questions about what is wrong with their playbook
This commit is contained in:
parent
e4a546e8bb
commit
3c2cbae68e
3 changed files with 23 additions and 0 deletions
|
@ -26,9 +26,19 @@ class Task(object):
|
|||
'play', 'notified_by', 'tags', 'with_items', 'first_available_file'
|
||||
]
|
||||
|
||||
# to prevent typos and such
|
||||
VALID_KEYS = [
|
||||
'name', 'action', 'only_if', 'async', 'poll', 'notify', 'with_items', 'first_available_file',
|
||||
'include', 'tags'
|
||||
]
|
||||
|
||||
def __init__(self, play, ds, module_vars=None):
|
||||
''' constructor loads from a task or handler datastructure '''
|
||||
|
||||
for x in ds.keys():
|
||||
if not x in Task.VALID_KEYS:
|
||||
raise errors.AnsibleError("%s is not a legal parameter in an Ansible task or handler" % x)
|
||||
|
||||
self.module_vars = module_vars
|
||||
self.play = play
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue