mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Better error message if the template is not utf-8 encoded (#41030)
* Better error message if the template is not utf-8 encoded Also document this in the porting guide
This commit is contained in:
parent
980cdbe679
commit
cef4d862bc
2 changed files with 10 additions and 1 deletions
|
@ -120,7 +120,10 @@ class ActionModule(ActionBase):
|
|||
# template the source data locally & get ready to transfer
|
||||
try:
|
||||
with open(b_tmp_source, 'rb') as f:
|
||||
template_data = to_text(f.read(), errors='surrogate_or_strict')
|
||||
try:
|
||||
template_data = to_text(f.read(), errors='surrogate_or_strict')
|
||||
except UnicodeError:
|
||||
raise AnsibleActionFail("Template source files must be utf-8 encoded")
|
||||
|
||||
# set jinja2 internal search path for includes
|
||||
searchpath = task_vars.get('ansible_search_path', [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue