fix(rundeck_acl_policy): compatible python 2 and 3 (#52473)
* fix(rundeck_acl_policy): compatible python 2 and 3 * Add changelog fragment * Use to_text instead of decode
This commit is contained in:
parent
b54086ef02
commit
008313b8cc
2 changed files with 6 additions and 2 deletions
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- Allow to use rundeck_acl_policy with python 2 and 3
|
|
@ -102,6 +102,7 @@ after:
|
|||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils._text import to_text
|
||||
import json
|
||||
|
||||
|
||||
|
@ -130,9 +131,9 @@ class RundeckACLManager:
|
|||
self.handle_http_code_if_needed(info)
|
||||
if resp is not None:
|
||||
resp = resp.read()
|
||||
if resp != "":
|
||||
if resp != b"":
|
||||
try:
|
||||
json_resp = json.loads(resp)
|
||||
json_resp = json.loads(to_text(resp, errors='surrogate_or_strict'))
|
||||
return json_resp, info
|
||||
except ValueError as e:
|
||||
self.module.fail_json(msg="Rundeck response was not a valid JSON. Exception was: %s. "
|
||||
|
|
Loading…
Add table
Reference in a new issue