Fixes include
- Setting cloexec flag on pipe files, using set_inheritable on sockets,
and close_fds=False on subprocess.Popen to work around file
descriptors not being inheritable by default in new versions of python
- Adding mitogen.exit_status variable and avoiding os.kill call so fake
'ssh' script is able to exit cleanly with correct status code
- Fixing broken os.dup call in ExternalContext._setup_master when input
and output streams have the same descriptor
- Updating fakessh module to do necessary python3 string/byte
conversions, and use updated mitogen Protocol, Stream, and Router apis
- Simplifying fakessh startup sequence so there aren't unnecessary
differences between ways control and data handles are passed, and ways
master and slave processes are initialized
- Fixing shutdown race conditions where subprocess exit handling or
stdin EOF handling could result in a truncated stdout stream
- Updating and adding a lot of docstrings and comments
- Adding Process.proc is None / is not None assertions to be clear about
which parts of fakessh.Process code are specific to the slave process,
and which parts are specific to the master process.
- Re-enabling unit test case and updating an outdated file path so it
passes
This reapplies an earlier change, when this plugin was first introduced to
Mitogen. The plugin was updated to fix
[DEPRECATION WARNING]: The '_remote_checksum()' method is deprecated.
I've elected to short-circuit the if statemtn logic, rather than
deleting/unindenting, to make the code delta much smaller. This should make it
easier to maintain/update.
Fixes#915
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
When the requested module (e.g. ansible.module_utils.distro)
- is provided by another module *e.g. distro)
- that itself was a package (e.g. distro 1.7.0)
At runtime
- ansible/module_utils/distro/__init__.py executes
- if https://pypi.org/project/distro/ is present, it's loaded as
ansible.module_utils.distro
- otherwise ansible/module_utils/distro/_distro.py is loaded
ParentEnumerationMethod would wrongly use whatever was in
sys.modules['ansible.module_utils.distro]. Instead we should ascend to
the first parent that has fullname == sys.modules[fullname].__name__.
Then descend to the appropriate .py file on disk.
This bug didn't show up before because until distro 1.7.0 (Feb 2022) the
top-level distro module was a module (distro.py) not a package
(distro/__init__.py)
fixes#906