summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2023-03-20 17:55:27 +0100
committerGitHub <noreply@github.com>2023-03-20 11:55:27 -0500
commitdcad473afc016283bf12fe4e1636f0266a91513e (patch)
tree26595bfc857d7e735c2c508809872330dd0b3677
parent1d3800a8d7b5a4f36552e30e648280ed62c347f1 (diff)
downloadansible-dcad473afc016283bf12fe4e1636f0266a91513e.tar.gz
Avoid redundant unsafe wrapping in ansible_eval_concat (#80143) (#80162)
The wrap_var is done in do_template for all concat functions after their return. (cherry picked from commit 694f12d01b17e4aba50bda55546edada6e79b5a8)
-rw-r--r--changelogs/fragments/ansible_eval_concat-remove-redundant-unsafe-wrap.yml2
-rw-r--r--lib/ansible/template/native_helpers.py5
2 files changed, 2 insertions, 5 deletions
diff --git a/changelogs/fragments/ansible_eval_concat-remove-redundant-unsafe-wrap.yml b/changelogs/fragments/ansible_eval_concat-remove-redundant-unsafe-wrap.yml
new file mode 100644
index 0000000000..50124edc6f
--- /dev/null
+++ b/changelogs/fragments/ansible_eval_concat-remove-redundant-unsafe-wrap.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - "``ansible_eval_concat`` - avoid redundant unsafe wrapping of templated strings converted to Python types"
diff --git a/lib/ansible/template/native_helpers.py b/lib/ansible/template/native_helpers.py
index 343e10c709..3014c74507 100644
--- a/lib/ansible/template/native_helpers.py
+++ b/lib/ansible/template/native_helpers.py
@@ -14,7 +14,6 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.six import string_types
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
from ansible.utils.native_jinja import NativeJinjaText
-from ansible.utils.unsafe_proxy import wrap_var
_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 out.startswith(('{', '[')) or out in ('True', 'False'):
- unsafe = hasattr(out, '__UNSAFE__')
try:
out = ast.literal_eval(
ast.fix_missing_locations(
@@ -71,9 +69,6 @@ def ansible_eval_concat(nodes):
)
except (ValueError, SyntaxError, MemoryError):
pass
- else:
- if unsafe:
- out = wrap_var(out)
return out