sdecode strings in highstate outputter

This commit is contained in:
Justin Findlay 2015-11-11 14:52:50 -07:00
parent 1e510be55b
commit fe4d08526d

View file

@ -69,7 +69,6 @@ import textwrap
# Import salt libs
import salt.utils
import salt.utils.locales
import salt.output
from salt.utils.locales import sdecode
@ -87,6 +86,8 @@ def output(data):
def _format_host(host, data):
host = sdecode(host)
colors = salt.utils.get_colors(
__opts__.get('color'),
__opts__.get('color_theme'))
@ -157,7 +158,7 @@ def _format_host(host, data):
if ret['result'] is None:
hcolor = colors['LIGHT_YELLOW']
tcolor = colors['LIGHT_YELLOW']
comps = tname.split('_|-')
comps = [sdecode(comp) for comp in tname.split('_|-')]
if __opts__.get('state_output', 'full').lower() == 'filter':
# By default, full data is shown for all types. However, return
# data may be excluded by setting state_output_exclude to a
@ -234,7 +235,7 @@ def _format_host(host, data):
# but try to continue on errors
pass
try:
comment = salt.utils.locales.sdecode(ret['comment'])
comment = sdecode(ret['comment'])
comment = comment.strip().replace(
u'\n',
u'\n' + u' ' * 14)
@ -267,7 +268,7 @@ def _format_host(host, data):
'tcolor': tcolor,
'comps': comps,
'ret': ret,
'comment': comment,
'comment': sdecode(comment),
# This nukes any trailing \n and indents the others.
'colors': colors
}