1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

When checking conditionals, don't dereference when the variable contains dashes

Fixes #4104
This commit is contained in:
James Cammarata 2013-09-13 13:52:58 -05:00
parent d2bf244eb8
commit 35d138a0d6

View file

@ -164,7 +164,7 @@ def check_conditional(conditional, basedir, inject, fail_on_undefined=False, jin
if conditional.startswith("jinja2_compare"): if conditional.startswith("jinja2_compare"):
conditional = conditional.replace("jinja2_compare ","") conditional = conditional.replace("jinja2_compare ","")
# allow variable names # allow variable names
if conditional in inject: if conditional in inject and str(inject[conditional]).find('-') == -1:
conditional = inject[conditional] conditional = inject[conditional]
conditional = template.template(basedir, conditional, inject, fail_on_undefined=fail_on_undefined) conditional = template.template(basedir, conditional, inject, fail_on_undefined=fail_on_undefined)
# a Jinja2 evaluation that results in something Python can eval! # a Jinja2 evaluation that results in something Python can eval!