Fix in v2 for bare variable conversion

This commit is contained in:
James Cammarata 2015-02-10 11:27:45 -06:00
parent 38b0a6ae87
commit 0e834509c8

View file

@ -70,12 +70,10 @@ class Conditional:
if conditional is None or conditional == '':
return True
# FIXME: this should be removable now, leaving it here just in case
# allow variable names
#if conditional in all_vars and '-' not in str(all_vars[conditional]):
# conditional = all_vars[conditional]
if conditional in all_vars and '-' not in unicode(all_vars[conditional]):
conditional = all_vars[conditional]
conditional = templar.template(conditional, convert_bare=True)
conditional = templar.template(conditional)
if not isinstance(conditional, basestring) or conditional == "":
return conditional
@ -89,9 +87,9 @@ class Conditional:
# variable was undefined. If we happened to be
# looking for an undefined variable, return True,
# otherwise fail
if "is undefined" in conditional:
if "is undefined" in original:
return True
elif "is defined" in conditional:
elif "is defined" in original:
return False
else:
raise AnsibleError("error while evaluating conditional: %s" % original)