mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
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
|
environment.filters['from_yaml'] = yaml.load
|
||||||
try:
|
try:
|
||||||
data = codecs.open(realpath, encoding="utf8").read()
|
data = codecs.open(realpath, encoding="utf8").read()
|
||||||
except:
|
except UnicodeDecodeError:
|
||||||
raise errors.AnsibleError("unable to process as utf-8: %s" % realpath)
|
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)
|
t = environment.from_string(data)
|
||||||
vars = vars.copy()
|
vars = vars.copy()
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue