Convert byte strings to unicode strings in our task results (#15581)

Fixes #15367
pull/15377/merge
Toshio Kuratomi 9 years ago committed by Brian Coca
parent 3b96861b7c
commit 2fd7f194c8

@ -26,7 +26,7 @@ import sys
import time import time
import traceback import traceback
from ansible.compat.six import iteritems, string_types from ansible.compat.six import iteritems, string_types, binary_type
from ansible import constants as C from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable, AnsibleConnectionFailure from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable, AnsibleConnectionFailure
@ -137,6 +137,8 @@ class TaskExecutor:
res[idx] = _clean_res(item) res[idx] = _clean_res(item)
elif isinstance(res, UnsafeProxy): elif isinstance(res, UnsafeProxy):
return res._obj return res._obj
elif isinstance(res, binary_type):
return to_unicode(res, errors='strict')
return res return res
display.debug("dumping result to json") display.debug("dumping result to json")

Loading…
Cancel
Save