Avoid redundant unsafe wrapping in ansible_eval_concat (#80143)

The wrap_var is done in do_template for all concat functions after their
return.
pull/80156/head
Martin Krizek 2 years ago committed by GitHub
parent 12c1891ce6
commit 694f12d01b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "``ansible_eval_concat`` - avoid redundant unsafe wrapping of templated strings converted to Python types"

@ -14,7 +14,6 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
from ansible.utils.native_jinja import NativeJinjaText from ansible.utils.native_jinja import NativeJinjaText
from ansible.utils.unsafe_proxy import wrap_var
_JSON_MAP = { _JSON_MAP = {
@ -60,7 +59,6 @@ def ansible_eval_concat(nodes):
# if this looks like a dictionary, list or bool, convert it to such # if this looks like a dictionary, list or bool, convert it to such
if out.startswith(('{', '[')) or out in ('True', 'False'): if out.startswith(('{', '[')) or out in ('True', 'False'):
unsafe = hasattr(out, '__UNSAFE__')
try: try:
out = ast.literal_eval( out = ast.literal_eval(
ast.fix_missing_locations( ast.fix_missing_locations(
@ -71,9 +69,6 @@ def ansible_eval_concat(nodes):
) )
except (ValueError, SyntaxError, MemoryError): except (ValueError, SyntaxError, MemoryError):
pass pass
else:
if unsafe:
out = wrap_var(out)
return out return out

Loading…
Cancel
Save