ansible/test/units
Adrian Likins dd0189839e Fix bug (#18355) where encrypted inventories fail 18355 (#18373)
* Fix bug (#18355) where encrypted inventories fail

This is first part of fix for #18355
* Make DataLoader._get_file_contents return bytes

The issue #18355 is caused by a change to inventory to
stop using _get_file_contents so that it can handle text
encoding itself to better protect against harmless text
encoding errors in ini files (invalid unicode text in
comment fields).

So this makes _get_file_contents return bytes so it and other
callers can handle the to_text().

The data returned by _get_file_contents() is now a bytes object
instead of a text object. The callers of _get_file_contents() have
been updated to call to_text() themselves on the results.

Previously, the ini parser attempted to work around
ini files that potentially include non-vailid unicode
in comment lines. To do this, it stopped using
DataLoader._get_file_contents() which does the decryption of
files if vault encrypted. It didn't use that because _get_file_contents
previously did to_text() on the read data itself.

_get_file_contents() returns a bytestring now, so ini.py
can call it and still special case ini file comments when
converting to_text(). That also means encrypted inventory files
are decrypted first.

Fixes #18355
2016-11-07 10:07:26 -05:00
..
cli set galaxy unit test server to None (#18298) 2016-11-02 10:25:09 -04:00
contrib Add a new vmware inventory script backed by pyvmomi (#15967) 2016-05-30 20:41:48 -04:00
errors Relocate use of ERROR to display class, to avoid doubling up 2016-01-19 12:10:39 -05:00
executor Change v2_playbook_on_start logic to positively detect legacy plugins 2016-10-28 10:05:58 -07:00
inventory Changing up how host (in)equality is checked 2015-12-04 12:57:46 -05:00
inventory_test_data/group_vars
mock Fix bug (#18355) where encrypted inventories fail 18355 (#18373) 2016-11-07 10:07:26 -05:00
module_utils Set ansible_os_family correctly under KDE neon 2016-10-27 20:28:38 +01:00
modules Clean up shebangs for various files. 2016-11-02 17:00:27 -07:00
parsing Fix bug (#18355) where encrypted inventories fail 18355 (#18373) 2016-11-07 10:07:26 -05:00
playbook Fix uninitialized variable in deserialize method (#18037) 2016-10-20 22:54:16 -04:00
plugins Clean up shebangs for various files. 2016-11-02 17:00:27 -07:00
template Merge branch 'threaded_receiver' into devel 2016-09-20 09:18:26 -05:00
utils FEATURE: adding variable serial batches 2016-08-04 15:04:10 -05:00
vars Make ini parsing slightly more robust 2016-10-04 11:24:50 -07:00
__init__.py