From 3cf0c09ce9210b3cf1e986523b99dd1ece9e6583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20R=C3=A9mond?= Date: Fri, 12 Dec 2014 12:11:17 +0100 Subject: [PATCH] Variables lookup in a template should handle properly the undefined case --- lib/ansible/utils/template.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 3e7f5e4d811..0098aa8b897 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -93,6 +93,8 @@ def lookup(name, *args, **kwargs): ran = instance.run(*args, inject=tvars, **kwargs) except errors.AnsibleError: raise + except jinja2.exceptions.UndefinedError, e: + raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e)) except Exception, e: raise errors.AnsibleError('Unexpected error in during lookup: %s' % e) if ran: