mirror of https://github.com/ansible/ansible.git
Allow for lazy evaluation of Jinja2 expressions (#56116)
parent
f2ab920822
commit
cbe42bff7f
@ -0,0 +1,2 @@
|
||||
breaking_changes:
|
||||
- Allow for lazy evaluation of Jinja2 expressions (https://github.com/ansible/ansible/issues/56017)
|
@ -0,0 +1,24 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
deep_undefined: "{{ nested_undefined_variable }}"
|
||||
tasks:
|
||||
- name: These do not throw an error, deep_undefined is just evaluated to undefined, since 2.13
|
||||
assert:
|
||||
that:
|
||||
- lazy_eval or deep_undefined
|
||||
- deep_undefined is undefined
|
||||
- deep_undefined|default('defaulted') == 'defaulted'
|
||||
vars:
|
||||
lazy_eval: true
|
||||
|
||||
- name: EXPECTED FAILURE actually using deep_undefined fails
|
||||
debug:
|
||||
msg: "{{ deep_undefined }}"
|
||||
ignore_errors: true
|
||||
register: res
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- res.failed
|
||||
- res.msg is contains("'nested_undefined_variable' is undefined")
|
Loading…
Reference in New Issue