1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #10426 from shirou/fix-hostvar-unicode-error

use to_unicode() in _jinja2_vars if type is str.
This commit is contained in:
Toshio Kuratomi 2015-03-11 20:39:50 -07:00
commit f5264414db

View file

@ -33,7 +33,7 @@ import ast
import traceback
from ansible.utils.string_functions import count_newlines_from_end
from ansible.utils import to_bytes
from ansible.utils import to_bytes, to_unicode
class Globals(object):
@ -184,6 +184,7 @@ class _jinja2_vars(object):
var = self.vars[varname]
# HostVars is special, return it as-is, as is the special variable
# 'vars', which contains the vars structure
var = to_unicode(var, nonstring="passthru")
if isinstance(var, dict) and varname == "vars" or isinstance(var, HostVars):
return var
else: