mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #37222 from xofyarg/develop
decode pillar on minion side on receiving
This commit is contained in:
commit
9e206b67fa
@ -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):
|
||||
|
@ -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_
|
||||
|
Loading…
Reference in New Issue
Block a user