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)