1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/lib/ansible/module_utils
nathaniel gentile 441dc369ba py3 compatibility: convert bytes to str (#33206)
Fixes #31723
In python3, ansible's fetch_url utility function wraps urllib.request.urlopen.
For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse object slightly modified.
Calling .read() on an HTTPResponse object returns bytes (note the docstring fix).

Here, to_native is used to convert the bytestrings returned by fetch_url into unicode strings.
This is necessary because:
  1. Pre python3.6, json.loads requires passing a string, not a bytestring, as its argument
  2. In python3 generally, testing if a string is a substring of a bytestring
     using the 'in' operator will raise a TypeError

see:
- https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen
- https://docs.python.org/3/library/http.client.html#http.client.HTTPResponse.read
- https://docs.python.org/3/library/json.html#json.loads
2017-12-15 16:17:15 -06:00
..
aws Create common waf module for use by future waf modules (#33003) 2017-12-08 15:50:26 -05:00
facts Included ansible_distribution_major_version #29561 (#31754) 2017-12-14 08:22:48 -06:00
network nso_action for Cisco NSO (#32781) 2017-12-15 11:29:04 +00:00
parsing Relicense convert_bool to 2-clause BSD 2017-10-18 14:33:28 -07:00
powershell added powershell symlink util helper (#27153) 2017-11-16 10:12:02 +10:00
remote_management Connection and MAC pool module for Cisco UCS (#31151) 2017-12-14 19:38:35 +01:00
six
__init__.py Enhance empty __init__ code-smell to check module_utils (#33438) 2017-11-30 15:47:38 -08:00
_text.py
ansible_tower.py ansible_tower: fix broken import, reuse tower_argument_spec and documentation fragment (#29115) 2017-10-02 16:21:24 -04:00
api.py
azure_rm_common.py add Azure user agent for Visual Studio Code extension (#33366) 2017-12-13 06:57:37 +10:00
basic.py fix file attributes changed detection 2017-12-15 09:48:18 -08:00
cloud.py
cloudscale.py cloudscale_floating_ip module (#33181) 2017-12-11 14:48:35 +00:00
cloudstack.py cloudstack: update copyright header (#32922) 2017-11-15 12:55:46 +01:00
connection.py Refactor junos modules to Use netconf and cliconf plugins (#32621) 2017-11-24 12:04:47 +05:30
crypto.py Allow multiple values per key in name fields in openssl_certificate/csr (#30338) 2017-12-12 12:35:22 +00:00
database.py
digital_ocean.py
dimensiondata.py
docker_common.py Fix invalid string escape sequences. 2017-11-21 10:03:34 -08:00
ec2.py [cloud] Improve snake <-> camel conversion for AWS utils (#31400) 2017-12-13 15:13:26 -05:00
exoscale.py
f5_utils.py Refactor common network shared and platform utils code into package (#33452) 2017-12-03 21:42:30 +05:30
gcdns.py
gce.py
gcp.py
infinibox.py
influxdb.py influxdb: fix missing arg specs (#33859) 2017-12-13 12:41:57 +01:00
ipa.py New module for managing IPA Sub CA (#25640) 2017-11-16 02:21:59 +00:00
ismount.py
json_utils.py jsonify inventory (#32990) 2017-11-21 13:41:27 -08:00
k8s_common.py move to use ansible logging 2017-10-16 11:34:55 -07:00
keycloak.py Add keycloak_client module for administration of Keycloak clients (#31716) 2017-11-29 16:44:35 -05:00
known_hosts.py Fix invalid string escape sequences. 2017-11-21 10:03:34 -08:00
lxd.py
manageiq.py module_utils/manageiq: add find_collection_resource_or_fail 2017-11-06 11:41:57 -05:00
mysql.py
netapp.py
oneview.py DatacenterFactsModule for HPE OneView (#32701) 2017-11-28 13:49:51 +00:00
openshift_common.py
openstack.py
ovirt.py ovirt_templates: wait for OK state when importing (#31634) 2017-11-02 09:24:42 -04:00
postgres.py
pure.py
pycompat24.py
rax.py Fix invalid string escape sequences. 2017-11-21 10:03:34 -08:00
redhat.py
service.py Connection plugins network_cli and netconf (#32521) 2017-11-09 15:04:40 -05:00
splitter.py
univention_umc.py Remove uses of assert in production code (#32079) 2017-11-13 11:51:18 -05:00
urls.py py3 compatibility: convert bytes to str (#33206) 2017-12-15 16:17:15 -06:00
vca.py
vmware.py VMware: check for ESXi server while creating user (#33061) 2017-12-15 16:26:19 +05:30
vultr.py vultr: new module utils and common docs (#30868) 2017-11-01 20:16:59 +01:00