If you convert the error string to bytes and embed it inside another
error string, you get
Prefix:
b'Embedded\nerror\nstring'
which is not what we want.
But we also don't want Unicode in error messages causing unexpected
UnicodeEncodeErrors when on Python 2.
So let's convert the error message into the native string type (bytes on
Python 2, unicode on Python 3).
* Don't throw away the full path of the module code being loaded,
as this can cause conflicts when files of the same name are being
instantiated
* Generalize the module loading code
Fixes#12738
This reverts commit 073f10a52a and instead
disables the failing test.
We're focusing on Python 3 support on the controller first; modules will
come later.
Fixes a test failure:
======================================================================
ERROR: test_module_utils_basic_ansible_module_creation (units.module_utils.test_basic.TestModuleUtilsBasic)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mg/src/ansible/test/units/module_utils/test_basic.py", line 250, in test_module_utils_basic_ansible_module_creation
supports_check_mode=True,
File "/home/mg/src/ansible/lib/ansible/module_utils/basic.py", line 470, in __init__
self._check_required_arguments()
File "/home/mg/src/ansible/lib/ansible/module_utils/basic.py", line 1050, in _check_required_arguments
self.fail_json(msg="missing required arguments: %s" % ",".join(missing))
File "/home/mg/src/ansible/lib/ansible/module_utils/basic.py", line 1445, in fail_json
sys.exit(1)
SystemExit: 1
-------------------- >> begin captured stdout << ---------------------
{"msg": "missing required arguments: foo", "failed": true}
because converting 'foo' to bytes yields b'foo' on Python 3, which
doesn't match the native-unicode 'foo' argument spec.
* corrupt/invalid file causes tracebacks
* incorrect initialization of display/_display in BaseCacheModule class
* tweaking the way errors in get() on jsonfile caches work, to raise
a proper AnsibleError in that situation so the playbook/task is stopped
Fixes#12708
ansible_ssh_* changes from 1.9 to 2.0, original note made into a separate file
for easier editing, and an include for this new file added to each of the 6 file affected
by this change