From 87423f4a33f634470311ed6059c0bcdff850e043 Mon Sep 17 00:00:00 2001 From: Bill Dodd Date: Fri, 24 Jul 2020 16:35:33 -0500 Subject: [PATCH] Fix decoding of response payloads for python 3.5 (#687) * fix decoding of response payloads for python 3.5 * add changelog fragment --- .../fragments/687-fix-redfish-payload-decode-python35.yml | 2 ++ plugins/module_utils/redfish_utils.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/687-fix-redfish-payload-decode-python35.yml diff --git a/changelogs/fragments/687-fix-redfish-payload-decode-python35.yml b/changelogs/fragments/687-fix-redfish-payload-decode-python35.yml new file mode 100644 index 0000000000..93b3ed2512 --- /dev/null +++ b/changelogs/fragments/687-fix-redfish-payload-decode-python35.yml @@ -0,0 +1,2 @@ +bugfixes: + - redfish_info, redfish_config, redfish_command - Fix Redfish response payload decode on Python 3.5 (https://github.com/ansible-collections/community.general/issues/686) diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 09adeabb6f..e1bef84e72 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -6,6 +6,7 @@ __metaclass__ = type import json from ansible.module_utils.urls import open_url +from ansible.module_utils._text import to_native from ansible.module_utils._text import to_text from ansible.module_utils.six.moves import http_client from ansible.module_utils.six.moves.urllib.error import URLError, HTTPError @@ -47,7 +48,7 @@ class RedfishUtils(object): force_basic_auth=True, validate_certs=False, follow_redirects='all', use_proxy=True, timeout=self.timeout) - data = json.loads(resp.read()) + data = json.loads(to_native(resp.read())) headers = dict((k.lower(), v) for (k, v) in resp.info().items()) except HTTPError as e: msg = self._get_extended_message(e)