mirror of
https://github.com/ansible/ansible.git
synced 2026-08-01 08:08:00 +02:00
Add location on include_tasks fail inside include (#83876)
Adds the datastore details to the parser error when attempting to include tasks that contain include_tasks without a filename set. This change will now display the exact location of the include_tasks that failed like any normal syntax error.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
- name: ping task
|
||||
ansible.builtin.ping:
|
||||
|
||||
- name: invalid include_task definition
|
||||
ansible.builtin.include_tasks:
|
||||
@@ -148,3 +148,9 @@ test "$(grep out.txt -ce 'In imported role')" = 3
|
||||
# https://github.com/ansible/ansible/issues/73657
|
||||
ansible-playbook issue73657.yml 2>&1 | tee issue73657.out
|
||||
test "$(grep -c 'SHOULD_NOT_EXECUTE' issue73657.out)" = 0
|
||||
|
||||
# https://github.com/ansible/ansible/issues/83874
|
||||
ansible-playbook test_null_include_filename.yml 2>&1 | tee test_null_include_filename.out
|
||||
test "$(grep -c 'ERROR! No file specified for ansible.builtin.include_tasks' test_null_include_filename.out)" = 1
|
||||
test "$(grep -c 'The error appears to be in '\''.*/include_import/null_filename/tasks.yml'\'': line 4, column 3.*' test_null_include_filename.out)" = 1
|
||||
test "$(grep -c '\- name: invalid include_task definition' test_null_include_filename.out)" = 1
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
- name: Test include failure with invalid included include_task
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- ansible.builtin.include_tasks:
|
||||
file: null_filename/tasks.yml
|
||||
Reference in New Issue
Block a user