mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Merge pull request #3645 from stoned/stringify-conditional-2
stringify conditional before handing it to Jinja2 for evaluation.
This commit is contained in:
@@ -164,7 +164,7 @@ def check_conditional(conditional, basedir, inject, fail_on_undefined=False):
|
||||
conditional = inject[conditional]
|
||||
conditional = template.template(basedir, conditional, inject, fail_on_undefined=fail_on_undefined)
|
||||
# a Jinja2 evaluation that results in something Python can eval!
|
||||
presented = "{% if " + conditional + " %} True {% else %} False {% endif %}"
|
||||
presented = "{%% if %s %%} True {%% else %%} False {%% endif %%}" % conditional
|
||||
conditional = template.template(basedir, presented, inject)
|
||||
val = conditional.lstrip().rstrip()
|
||||
if val == "True":
|
||||
|
||||
Reference in New Issue
Block a user