From 7347e54b706caec94f012be201ddb51d535820b4 Mon Sep 17 00:00:00 2001 From: fdavis Date: Thu, 13 Dec 2012 23:02:30 -0800 Subject: [PATCH] change error message on check_conditional when variable does not exist --- lib/ansible/utils/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index caefd3e9264..e547c1ac830 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -143,7 +143,10 @@ def check_conditional(conditional): def is_unset(var): 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): '''is the given path executable?'''