Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix traceback if no file in include_task #54044

Merged
merged 4 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- include_task - Fixed an unexpected exception if no file was given to include.
2 changes: 1 addition & 1 deletion lib/ansible/playbook/task_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def load(data, block=None, role=None, task_include=None, variable_manager=None,
raise AnsibleParserError('Invalid options for %s: %s' % (task.action, ','.join(list(bad_opts))), obj=data)

if not task.args.get('_raw_params'):
task.args['_raw_params'] = task.args.pop('file')
task.args['_raw_params'] = task.args.pop('file', None)

apply_attrs = task.args.get('apply', {})
if apply_attrs and task.action != 'include_tasks':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,13 @@

- name: include_tasks + action
action: include_tasks tasks1.yml

- name: test fail as expected without file
include_tasks:
ignore_errors: yes
register: res

- name: verify fail as expected without file
assert:
that:
- res.msg == 'No include file was specified to the include'