Commit 0756aa40 by Michael DeHaan

Change conditional operation workflow.

Conflicts:

	lib/ansible/utils/__init__.py
parent 7f462a34
......@@ -162,11 +162,17 @@ def check_conditional(conditional, basedir, inject, fail_on_undefined=False):
# allow variable names
if conditional in inject:
conditional = inject[conditional]
print "INJECTIFYING: %s" % inject
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 %}"
return presented
conditional = template.template(basedir, presented, inject)
val = conditional.lstrip().rstrip()
if val == "True":
return True
elif val == "False":
return False
else:
raise errors.AnsibleError("unable to evaluate conditional: %s" % conditional)
if not isinstance(conditional, basestring):
return conditional
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment