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

sensu-silence: fix json parsing of sensu API response (#1703)

* sensu-silence: fix json parsing of sensu API response

* use ansible helper function to decode bytestream

* add changelog fragment

* Update changelogs, link to PR

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Stefan Walluhn 2021-02-02 17:45:14 +01:00 committed by GitHub
parent 4e70c0c55a
commit b40a5ef09a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- sensu-silence module - fix json parsing of sensu API responses on Python 3.5 (https://github.com/ansible-collections/community.general/pull/1703).

View file

@ -97,6 +97,7 @@ RETURN = '''
import json
from ansible.module_utils._text import to_native
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
@ -129,7 +130,7 @@ def query(module, url, check, subscription):
)
try:
json_out = json.loads(response.read())
json_out = json.loads(to_native(response.read()))
except Exception:
json_out = ""
@ -181,7 +182,7 @@ def clear(module, url, check, subscription):
)
try:
json_out = json.loads(response.read())
json_out = json.loads(to_native(response.read()))
except Exception:
json_out = ""
@ -246,7 +247,7 @@ def create(
)
try:
json_out = json.loads(response.read())
json_out = json.loads(to_native(response.read()))
except Exception:
json_out = ""