From 4f38c1fea04460ff76f4607df0874fcbe18f9bda Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Thu, 16 Nov 2017 13:05:24 -0500 Subject: [PATCH] Fix another bytes issue (#32951) If results are bytestrings, they need to be cast to text before hitting json.loads() --- lib/ansible/utils/jsonrpc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/utils/jsonrpc.py b/lib/ansible/utils/jsonrpc.py index 8903d73a26..3a8a982490 100644 --- a/lib/ansible/utils/jsonrpc.py +++ b/lib/ansible/utils/jsonrpc.py @@ -9,6 +9,7 @@ import traceback from ansible import constants as C from ansible.module_utils._text import to_text +from ansible.module_utils.six import binary_type try: @@ -83,6 +84,8 @@ class JsonRpcServer(object): def response(self, result=None): response = self.header() + if isinstance(result, binary_type): + result = to_text(result) response['result'] = result return response