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

Swap default for INVALID_TASK_ATTRIBUTE_FAILED to True, add additional info to exception (#44138)

This commit is contained in:
Matt Martz 2018-08-16 16:30:47 -05:00 committed by GitHub
parent 0beaea22a4
commit 509e92ef72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -1385,8 +1385,8 @@ HOST_KEY_CHECKING:
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
default: True
description: If 'false', invalid attributes for a task will result in warnings instead of errors
type: boolean
env:
- name: ANSIBLE_INVALID_TASK_ATTRIBUTE_FAILED

View file

@ -248,6 +248,13 @@ class Task(Base, Conditional, Taggable, Become):
return LoopControl.load(data=ds, variable_manager=self._variable_manager, loader=self._loader)
def _validate_attributes(self, ds):
try:
super(Task, self)._validate_attributes(ds)
except AnsibleParserError as e:
e.message += '\nThis error can be suppressed as a warning using the "invalid_task_attribute_failed" configuration'
raise e
def post_validate(self, templar):
'''
Override of base class post_validate, to also do final validation on