Fix acme_inspect problem with Python 3.5 (#87)

* Fix JSON loading problem with Python 3.5.

* Add changelog fragment.

* Enable 3.5 tests.
pull/88/head
Felix Fontein 2020-07-13 21:10:23 +02:00 committed by GitHub
parent 0786e93bb9
commit a19756ee77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- "acme_inspect - fix problem with Python 3.5 that JSON was not decoded (https://github.com/ansible-collections/community.crypto/issues/86)."

View File

@ -243,7 +243,7 @@ output_json:
import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native, to_bytes
from ansible.module_utils._text import to_native, to_bytes, to_text
from ansible_collections.community.crypto.plugins.module_utils.acme import (
ModuleFailException,
@ -299,7 +299,8 @@ def main():
))
# See if we can parse the result as JSON
try:
result['output_json'] = json.loads(data)
# to_text() is needed only for Python 3.5 (and potentially 3.0 to 3.4 as well)
result['output_json'] = json.loads(to_text(data))
except Exception as dummy:
pass
# Fail if error was returned

View File

@ -37,7 +37,7 @@ matrix:
- env: T=devel/cloud/2.6/1
- env: T=devel/cloud/2.7/1
# - env: T=devel/cloud/3.5/1
- env: T=devel/cloud/3.5/1
- env: T=devel/cloud/3.6/1
- env: T=devel/cloud/3.7/1
- env: T=devel/cloud/3.8/1