ansible/lib/ansible
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
..
cli dont warn on not matching 'all' (#32806) 2017-12-15 15:43:51 -05:00
compat Create a short license for PSF and MIT. (#32212) 2017-11-06 10:25:30 -08:00
config Add Support for Mellanox switches: first module: mlnxos_command (#33121) 2017-11-27 20:55:08 +00:00
errors Remove uses of assert in production code (#32079) 2017-11-13 11:51:18 -05:00
executor Add parent pid to persistent connection socket path hash (#33518) 2017-12-15 10:21:56 +05:30
galaxy Fix a typo in the readme of the skeleton used by ansible-galaxy. (#33807) 2017-12-13 11:35:05 +01:00
inventory dont warn on not matching 'all' (#32806) 2017-12-15 15:43:51 -05:00
module_utils py3 compatibility: convert bytes to str (#33206) 2017-12-15 16:17:15 -06:00
modules py3 compatibility: convert bytes to str (#33206) 2017-12-15 16:17:15 -06:00
parsing Handle vault filenames with nonascii chars when displaying messages. Fixes #33879 (#33926) 2017-12-14 16:02:25 -06:00
playbook normalize names 2017-12-11 18:20:04 -05:00
plugins added flatten filter (#33102) 2017-12-15 14:40:02 -05:00
template Add q/query aliases to lookup (#33466) 2017-12-14 11:53:00 -06:00
utils nso_action for Cisco NSO (#32781) 2017-12-15 11:29:04 +00:00
vars fix item var in delegation (#32986) 2017-11-20 09:29:55 -05:00
__init__.py
constants.py Fixes eos sending 'None' to device (#33015) 2017-11-17 11:33:54 -05:00
release.py Bump the versions now that devel is 2.5 2017-09-06 13:13:57 -07:00