summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Poirier <user.name>2016-02-11 15:29:48 -0500
committerJames Cammarata <jimi@sngx.net>2016-02-11 22:51:26 -0500
commitcaf15375108a03205601c5462706f51356ec0359 (patch)
tree77749ccb407c4c3d591c6b1ae3c39a3b02888d83
parent6f54b1ae2b805244a2ff4dd58d7022c36fbba25c (diff)
downloadansible-caf15375108a03205601c5462706f51356ec0359.tar.gz
Display the string which is causing an exception to be raised.
In the ansible template module, when there is an error while expanding a templated string, displaying the string causing the exception is very useful.
-rw-r--r--lib/ansible/template/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py
index fdc8eba720..bec34f81aa 100644
--- a/lib/ansible/template/__init__.py
+++ b/lib/ansible/template/__init__.py
@@ -464,7 +464,7 @@ class Templar:
try:
t = myenv.from_string(data)
except TemplateSyntaxError as e:
- raise AnsibleError("template error while templating string: %s" % str(e))
+ raise AnsibleError("template error while templating string: %s. String: %s" % (str(e), data))
except Exception as e:
if 'recursion' in str(e):
raise AnsibleError("recursive loop detected in template string: %s" % data)