Skip to content

Commit

Permalink
import_tasks: Raise an error when applying notify
Browse files Browse the repository at this point in the history
notify is not valid import_tasks attribute. Raise an error
when user specifies it.

Fixes: ansible#64935

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde committed Nov 21, 2019
1 parent ede62b8 commit ebb48f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/64935_import_tasks.yml
@@ -0,0 +1,2 @@
bugfixes:
- Raise an error when including notify in import tasks (https://github.com/ansible/ansible/issues/64935).
7 changes: 7 additions & 0 deletions lib/ansible/playbook/task_include.py
Expand Up @@ -91,6 +91,13 @@ def preprocess_data(self, ds):
else:
display.warning("Ignoring invalid attribute: %s" % k)

# VALID_INCLUDE_KEYWORDS does not contain check_mode, which is supported by import_tasks
if ds['action'] in ('import_tasks') and ds['notify'] is not Sentinel:
if C.INVALID_TASK_ATTRIBUTE_FAILED:
raise AnsibleParserError("'notify' is not a valid attribute for a import_tasks", obj=ds)
else:
display.warning("Ignoring invalid attribute: 'notify'")

return ds

def copy(self, exclude_parent=False, exclude_tasks=False):
Expand Down

0 comments on commit ebb48f2

Please sign in to comment.