mirror of https://github.com/ansible/ansible.git
Move undefined check from concat to finalize (#78165)
* Move undefined check from concat to finalize In the classic Jinja2's Environment str() is called on the return value of the finalize method to potentially trigger the undefined error. That is not the case in NativeEnvironment where string conversion of the return value is not desired. We workaround that by checking for Undefined in all of our concat functions. It seems simpler to do it earlier in the finalize method(s) instead. As a side-effect it fixes an undefined variable detection in imported templates. Fixes #78156 ci_complete * Fix sanity * ... * sighpull/78171/head
parent
953a86f5a6
commit
17d52c8d64
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Move undefined check from concat to finalize (https://github.com/ansible/ansible/issues/78156)
|
||||
@ -0,0 +1 @@
|
||||
{{ undefined_variable }}
|
||||
@ -0,0 +1 @@
|
||||
{% import 'undefined_in_import-import.j2' as t %}
|
||||
@ -0,0 +1,11 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- debug:
|
||||
msg: "{{ lookup('template', 'undefined_in_import.j2') }}"
|
||||
ignore_errors: true
|
||||
register: res
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "\"'undefined_variable' is undefined\" in res.msg"
|
||||
Loading…
Reference in New Issue