Merge pull request #1441 from dhozac/better-error-missing-template
Improve the error message for missing files
This commit is contained in:
commit
9fca4eb241
1 changed files with 3 additions and 1 deletions
|
@ -407,8 +407,10 @@ def template_from_file(basedir, path, vars):
|
|||
environment.filters['from_yaml'] = yaml.load
|
||||
try:
|
||||
data = codecs.open(realpath, encoding="utf8").read()
|
||||
except:
|
||||
except UnicodeDecodeError:
|
||||
raise errors.AnsibleError("unable to process as utf-8: %s" % realpath)
|
||||
except:
|
||||
raise errors.AnsibleError("unable to read %s" % realpath)
|
||||
t = environment.from_string(data)
|
||||
vars = vars.copy()
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue