From 509e92ef72dbce56cdce413452be2b6268c5bf6c Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Thu, 16 Aug 2018 16:30:47 -0500 Subject: [PATCH] Swap default for INVALID_TASK_ATTRIBUTE_FAILED to True, add additional info to exception (#44138) --- lib/ansible/config/base.yml | 4 ++-- lib/ansible/playbook/task.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index d353993b447..3384d1a1071 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -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 diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index c9ed1d3e9a2..e314375d189 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -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