From 2fd7f194c8ecb1b1002279d0e31a34a296d71ae0 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 25 Apr 2016 09:35:25 -0700 Subject: [PATCH] Convert byte strings to unicode strings in our task results (#15581) Fixes #15367 --- lib/ansible/executor/task_executor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 3563abbcf1..0af2e2b35c 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -26,7 +26,7 @@ import sys import time 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.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable, AnsibleConnectionFailure @@ -137,6 +137,8 @@ class TaskExecutor: res[idx] = _clean_res(item) elif isinstance(res, UnsafeProxy): return res._obj + elif isinstance(res, binary_type): + return to_unicode(res, errors='strict') return res display.debug("dumping result to json")