Merge pull request #37222 from xofyarg/develop

decode pillar on minion side on receiving
This commit is contained in:
Mike Place 2016-10-27 15:17:31 +09:00 committed by GitHub
commit 9e206b67fa
2 changed files with 16 additions and 1 deletions

View File

@ -24,6 +24,7 @@ from salt.template import compile_template
from salt.utils.dictupdate import merge
from salt.utils.odict import OrderedDict
from salt.version import __version__
from salt.utils.locales import decode_recursively
# Import 3rd-party libs
import salt.ext.six as six
@ -162,7 +163,7 @@ class RemotePillar(object):
'{1}'.format(type(ret_pillar).__name__, ret_pillar)
)
return {}
return ret_pillar
return decode_recursively(ret_pillar)
class PillarCache(object):

View File

@ -114,3 +114,17 @@ def normalize_locale(loc):
comps['codeset'] = comps['codeset'].lower().replace('-', '')
comps['charmap'] = ''
return join_locale(comps)
def decode_recursively(object_):
if isinstance(object_, list):
return [decode_recursively(o) for o in object_]
if isinstance(object_, tuple):
return tuple([decode_recursively(o) for o in object_])
if isinstance(object_, dict):
return dict([(decode_recursively(key), decode_recursively(value))
for key, value in salt.ext.six.iteritems(object_)])
elif isinstance(object_, string_types):
return sdecode(object_)
else:
return object_