mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00: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:
@@ -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).
|
||||
@@ -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 = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user