mirror of https://github.com/ansible/ansible.git
Handle post_validate templating errors and fix tests (#70240)
* Handle unexpected templating errors * Fixes #70050 Fix up tests that weren't running and add tests for graceful templating error handlingpull/70394/head
parent
cc2cee6980
commit
30e70f4b63
@ -1,4 +1,4 @@
|
|||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- { role: templating_lookups }
|
- { role: template_lookups }
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
- name: Task that fails due to templating error for plugin option
|
||||||
|
debug: msg="{{ 5 / 0 | int }}"
|
||||||
|
ignore_errors: true
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.failed
|
||||||
|
- result.exception
|
||||||
|
|
||||||
|
- name: Loop that fails due to templating error in first entry and ignores errors
|
||||||
|
debug: msg="{{ 5 / item }}"
|
||||||
|
ignore_errors: true
|
||||||
|
register: result
|
||||||
|
loop: [0, 0, 1]
|
||||||
|
|
||||||
|
- debug: var=result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.results[0].failed
|
||||||
|
- result.results[0].exception
|
||||||
|
- result.results[0].item == 0
|
||||||
|
|
||||||
|
- result.results[1].failed
|
||||||
|
- result.results[1].exception
|
||||||
|
- result.results[1].item == 0
|
||||||
|
|
||||||
|
- not result.results[2].failed
|
||||||
|
- result.results[2].exception is undefined
|
||||||
|
- result.results[2].item == 1
|
Loading…
Reference in New Issue