mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Fix another bytes issue (#32951)
If results are bytestrings, they need to be cast to text before hitting json.loads()
This commit is contained in:
@@ -9,6 +9,7 @@ import traceback
|
|||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.module_utils._text import to_text
|
from ansible.module_utils._text import to_text
|
||||||
|
from ansible.module_utils.six import binary_type
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -83,6 +84,8 @@ class JsonRpcServer(object):
|
|||||||
|
|
||||||
def response(self, result=None):
|
def response(self, result=None):
|
||||||
response = self.header()
|
response = self.header()
|
||||||
|
if isinstance(result, binary_type):
|
||||||
|
result = to_text(result)
|
||||||
response['result'] = result
|
response['result'] = result
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user