Parser errors from within includes should not be rescueable (#73722)

* Parser errors from within includes should not be rescueable
* Also fixes unit tests
Fixes #73657
This commit is contained in:
Martin Krizek
2021-11-01 11:05:39 -04:00
committed by GitHub
parent d23226a6f4
commit 47ee282227
8 changed files with 39 additions and 6 deletions
@@ -0,0 +1,8 @@
- hosts: localhost
gather_facts: no
tasks:
- block:
- include_tasks: issue73657_tasks.yml
rescue:
- debug:
msg: SHOULD_NOT_EXECUTE
@@ -0,0 +1,2 @@
- wrong.wrong.wrong:
parser: error
@@ -135,3 +135,7 @@ cat out.txt
test "$(grep out.txt -ce 'In imported playbook')" = 2
test "$(grep out.txt -ce 'In imported tasks')" = 3
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