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

change error message on check_conditional when variable does not exist

This commit is contained in:
fdavis 2012-12-13 23:02:30 -08:00
parent 23f2a7fc7e
commit 7347e54b70

View file

@ -143,7 +143,10 @@ def check_conditional(conditional):
def is_unset(var): def is_unset(var):
return var.startswith("$") return var.startswith("$")
return eval(conditional.replace("\n", "\\n")) try:
return eval(conditional.replace("\n", "\\n"))
except SyntaxError as e:
raise errors.AnsibleError("Could not evaluate the expression: " + conditional)
def is_executable(path): def is_executable(path):
'''is the given path executable?''' '''is the given path executable?'''