Fix in v2 for bare variable conversion
This commit is contained in:
parent
38b0a6ae87
commit
0e834509c8
|
@ -70,12 +70,10 @@ class Conditional:
|
||||||
if conditional is None or conditional == '':
|
if conditional is None or conditional == '':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# FIXME: this should be removable now, leaving it here just in case
|
if conditional in all_vars and '-' not in unicode(all_vars[conditional]):
|
||||||
# allow variable names
|
conditional = all_vars[conditional]
|
||||||
#if conditional in all_vars and '-' not in str(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 == "":
|
if not isinstance(conditional, basestring) or conditional == "":
|
||||||
return conditional
|
return conditional
|
||||||
|
|
||||||
|
@ -89,9 +87,9 @@ class Conditional:
|
||||||
# variable was undefined. If we happened to be
|
# variable was undefined. If we happened to be
|
||||||
# looking for an undefined variable, return True,
|
# looking for an undefined variable, return True,
|
||||||
# otherwise fail
|
# otherwise fail
|
||||||
if "is undefined" in conditional:
|
if "is undefined" in original:
|
||||||
return True
|
return True
|
||||||
elif "is defined" in conditional:
|
elif "is defined" in original:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
raise AnsibleError("error while evaluating conditional: %s" % original)
|
raise AnsibleError("error while evaluating conditional: %s" % original)
|
||||||
|
|
Loading…
Reference in a new issue