1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix decoding of response payloads for python 3.5 (#687)

* fix decoding of response payloads for python 3.5

* add changelog fragment
This commit is contained in:
Bill Dodd 2020-07-24 16:35:33 -05:00 committed by GitHub
parent 748fb40541
commit 87423f4a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -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)

View file

@ -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)