mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
This is a fix on top of the 'airplane variable upgrade' commits that fixes legacy when_string so it evaluates correctly in the new eval construct.
This commit is contained in:
parent
3e58768344
commit
a05361f515
2 changed files with 11 additions and 6 deletions
|
@ -66,7 +66,6 @@ def _executor_hook(job_queue, result_queue):
|
|||
return_data = multiprocessing_runner._executor(host)
|
||||
result_queue.put(return_data)
|
||||
|
||||
# print "FLAGS=%s" % return_data.flags
|
||||
if 'LEGACY_TEMPLATE_WARNING' in return_data.flags:
|
||||
# pass data back up across the multiprocessing fork boundary
|
||||
template.Flags.LEGACY_TEMPLATE_WARNING = True
|
||||
|
|
|
@ -601,12 +601,18 @@ def compile_when_to_only_if(expression):
|
|||
cast = 'float'
|
||||
tcopy = tokens[1:]
|
||||
for (i,t) in enumerate(tokens[1:]):
|
||||
if t.find("$") != -1:
|
||||
# final variable substitution will happen in Runner code
|
||||
tcopy[i] = "%s('''%s''')" % (cast, t)
|
||||
#if re.search(t, r"^\w"):
|
||||
# bare word will turn into Jinja2 so all the above
|
||||
# casting is really not needed
|
||||
#tcopy[i] = "%s('''%s''')" % (cast, t)
|
||||
t2 = t.strip()
|
||||
if (t2[0].isalpha() or t2[0] == '$') and cast == 'str':
|
||||
tcopy[i] = "'%s'" % (t)
|
||||
else:
|
||||
tcopy[i] = t
|
||||
return " ".join(tcopy)
|
||||
tcopy[i] = t
|
||||
result = " ".join(tcopy)
|
||||
return result
|
||||
|
||||
|
||||
# when_boolean
|
||||
elif tokens[0] in [ 'bool', 'boolean' ]:
|
||||
|
|
Loading…
Reference in a new issue