mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
More 1.2 templating development; for legacy when_string constructs don't quote the 'in' operator
This commit is contained in:
@@ -155,7 +155,6 @@ def check_conditional(conditional):
|
|||||||
if not isinstance(conditional, basestring):
|
if not isinstance(conditional, basestring):
|
||||||
return conditional
|
return conditional
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conditional = conditional.replace("\n", "\\n")
|
conditional = conditional.replace("\n", "\\n")
|
||||||
result = safe_eval(conditional)
|
result = safe_eval(conditional)
|
||||||
@@ -606,7 +605,7 @@ def compile_when_to_only_if(expression):
|
|||||||
# casting is really not needed
|
# casting is really not needed
|
||||||
#tcopy[i] = "%s('''%s''')" % (cast, t)
|
#tcopy[i] = "%s('''%s''')" % (cast, t)
|
||||||
t2 = t.strip()
|
t2 = t.strip()
|
||||||
if (t2[0].isalpha() or t2[0] == '$') and cast == 'str':
|
if (t2[0].isalpha() or t2[0] == '$') and cast == 'str' and t2 != 'in':
|
||||||
tcopy[i] = "'%s'" % (t)
|
tcopy[i] = "'%s'" % (t)
|
||||||
else:
|
else:
|
||||||
tcopy[i] = t
|
tcopy[i] = t
|
||||||
|
|||||||
Reference in New Issue
Block a user