mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Catch template syntax errors specifically when templating strings
Fixes #9333
This commit is contained in:
@@ -340,6 +340,8 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
|
||||
|
||||
try:
|
||||
t = environment.from_string(data)
|
||||
except TemplateSyntaxError, e:
|
||||
raise errors.AnsibleError("template error while templating string: %s" % str(e))
|
||||
except Exception, e:
|
||||
if 'recursion' in str(e):
|
||||
raise errors.AnsibleError("recursive loop detected in template string: %s" % data)
|
||||
|
||||
Reference in New Issue
Block a user