1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add config to fail on invalid task attributes. Fixes #42479

This commit is contained in:
Matt Martz 2018-07-08 21:11:39 +03:00 committed by Brian Coca
parent 937e710485
commit 8aea8901c3
2 changed files with 12 additions and 1 deletions

View file

@ -1375,6 +1375,17 @@ HOST_KEY_CHECKING:
ini:
- {key: host_key_checking, section: defaults}
type: boolean
INVALID_TASK_ATTRIBUTE_FAILED:
name: Controls whether invalid attributes for a task result in errors instead of warnings
default: false
description: If 'true', invalid attributes for a task will result in errors instead of warnings
type: boolean
env:
- name: ANSIBLE_INVALID_TASK_ATTRIBUTE_FAILED
ini:
- key: invalid_task_attribute_failed
section: defaults
version_added: "2.7"
INVENTORY_ANY_UNPARSED_IS_FAILED:
name: Controls whether any unparseable inventory source is a fatal error
default: False

View file

@ -231,7 +231,7 @@ class Task(Base, Conditional, Taggable, Become):
" Please see:\nhttps://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse\n\n"
" for currently supported syntax regarding included files and variables", version="2.7")
new_ds['vars'][k] = v
elif k in self._valid_attrs:
elif C.INVALID_TASK_ATTRIBUTE_FAILED or k in self._valid_attrs:
new_ds[k] = v
else:
display.warning("Ignoring invalid attribute: %s" % k)