mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
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.
This commit is contained in:
@@ -464,7 +464,7 @@ class Templar:
|
|||||||
try:
|
try:
|
||||||
t = myenv.from_string(data)
|
t = myenv.from_string(data)
|
||||||
except TemplateSyntaxError as e:
|
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:
|
except Exception as e:
|
||||||
if 'recursion' in str(e):
|
if 'recursion' in str(e):
|
||||||
raise AnsibleError("recursive loop detected in template string: %s" % data)
|
raise AnsibleError("recursive loop detected in template string: %s" % data)
|
||||||
|
|||||||
Reference in New Issue
Block a user