File tree Expand file tree Collapse file tree 5 files changed +11
-19
lines changed
integration/targets/jinja2_native_types Expand file tree Collapse file tree 5 files changed +11
-19
lines changed Original file line number Diff line number Diff line change 1313from jinja2 .runtime import StrictUndefined
1414
1515from ansible .module_utils ._text import to_text
16+ from ansible .module_utils .common .text .converters import container_to_text
17+ from ansible .module_utils .six import PY2
1618from ansible .parsing .yaml .objects import AnsibleVaultEncryptedUnicode
1719
1820
@@ -48,10 +50,6 @@ def ansible_native_concat(nodes):
4850 # See https://github.com/ansible/ansible/issues/52158
4951 # We do that only here because it is taken care of by to_text() in the else block below already.
5052 str (out )
51-
52- # short circuit literal_eval when possible
53- if not isinstance (out , list ):
54- return out
5553 else :
5654 if isinstance (nodes , types .GeneratorType ):
5755 nodes = chain (head , nodes )
@@ -60,6 +58,10 @@ def ansible_native_concat(nodes):
6058 out = u'' .join ([to_text (v ) for v in nodes ])
6159
6260 try :
63- return literal_eval (out )
61+ out = literal_eval (out )
62+ if PY2 :
63+ # ensure bytes are not returned back into Ansible from templating
64+ out = container_to_text (out )
65+ return out
6466 except (ValueError , SyntaxError , MemoryError ):
6567 return out
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11- name : cast things to other things
22 set_fact :
3- int_to_str : " {{ i_two|to_text }}"
3+ int_to_str : " ' {{ i_two }}' "
44 str_to_int : " {{ s_two|int }}"
5- dict_to_str : " {{ dict_one|to_text }}"
6- list_to_str : " {{ list_one|to_text }}"
5+ dict_to_str : " ' {{ dict_one }}' "
6+ list_to_str : " ' {{ list_one }}' "
77 int_to_bool : " {{ i_one|bool }}"
88 str_true_to_bool : " {{ s_true|bool }}"
99 str_false_to_bool : " {{ s_false|bool }}"
Original file line number Diff line number Diff line change 1818
1919- name : concatenate int and string
2020 set_fact :
21- string_sum : " {{ [( i_one|to_text) , s_two]|join('') }}"
21+ string_sum : " ' {{ [i_one, s_two]|join('') }}' "
2222
2323- assert :
2424 that :
Original file line number Diff line number Diff line change @@ -286,8 +286,6 @@ test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.1/DSCResources/AN
286286test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.1/xTestDsc.psd1 pslint!skip
287287test/integration/targets/incidental_win_ping/library/win_ping_syntax_error.ps1 pslint!skip
288288test/integration/targets/incidental_win_reboot/templates/post_reboot.ps1 pslint!skip
289- test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py future-import-boilerplate
290- test/integration/targets/jinja2_native_types/filter_plugins/native_plugins.py metaclass-boilerplate
291289test/integration/targets/lookup_ini/lookup-8859-15.ini no-smart-quotes
292290test/integration/targets/module_precedence/lib_with_extension/ping.py future-import-boilerplate
293291test/integration/targets/module_precedence/lib_with_extension/ping.py metaclass-boilerplate
You can’t perform that action at this time.
0 commit comments