Handle TemplateNotFound to render more helpful error message.

At the point the exception is handled, it is likely due to error loading
a sub-template included from main template. Besides file not found, it
can be caused also by include path failing Jinja2 checks. Now, when
rendering the exception from Jinja, it will include exception name. This
will give basic context or *what* the error is.

Fixes #7103
Fixes #7105
This commit is contained in:
Paul Sokolovsky
2014-06-23 15:00:05 -05:00
committed by James Cammarata
parent 52c7d50f1e
commit f8bf9cdeec
2 changed files with 11 additions and 1 deletions

View File

@@ -87,7 +87,7 @@ class ActionModule(object):
try:
resultant = template.template_from_file(self.runner.basedir, source, inject, vault_password=self.runner.vault_pass)
except Exception, e:
result = dict(failed=True, msg=str(e))
result = dict(failed=True, msg=type(e).__name__ + ": " + str(e))
return ReturnData(conn=conn, comm_ok=False, result=result)
local_md5 = utils.md5s(resultant)