Commit Graph

601 Commits (master)

Author SHA1 Message Date
Alex Willmer 4996ec2f09 ansible_mitogen: Fix "filedescriptor out of range in select()" in WorkerProcess
`mitogen.parent.POLLER_LIGHTWEIGHT` will normally be `PollPoller`, falling
back to `EpollPoller`, `KqueuePoller`, or `Poller`.

Fixes #957

Co-authored-by: Luca Berruti <nadirio@gmail.com>
Co-authored-by: Philippe Kueck <bqobccy6ejnq2bqvmebqiwqha4cs4@protected32.unixadm.org>
2 weeks ago
Alex Willmer d5e9186289 ansible_mitogen: Fix --ask-become-pass, add test coverage
Previously f1503874de fixed the priority of
ansible_become_pass over ansible_become_password, but broke --ask-become-pass.
Fixes #952.
3 weeks ago
Alex Willmer cca651da1f ansible_mitogen: Ansible 9 (ansible-core 2.16) support 4 weeks ago
Alex Willmer fa1d21747f ansible_mitogen: Declare Ansible 8 (ansible-core 2.15) support
refs #1021
1 month ago
Alex Willmer b822f20007 ansible_mitogen: Handle AnsibleUnsafeText et al in Ansible >= 7
Follwing fixes in Ansible 7-9 for CVE-2023-5764 cating `AnsibleUnsafeBytes` &
`AnsibleUnsafeText` to `bytes()` or `str()` requires special handling. The
handling is Ansible specific, so it shouldn't go in the mitogen package but
rather the ansible_mitogen package.

`ansible_mitogen.utils.unsafe.cast()` is most like `mitogen.utils.cast()`.
During development it began as `ansible_mitogen.utils.unsafe.unwrap_var()`,
closer to an inverse of `ansible.utils.unsafe_procy.wrap_var()`. Future
enhancements may move in this direction.

refs #977, refs #1046

See also
- https://github.com/advisories/GHSA-7j69-qfc3-2fq9
- https://github.com/ansible/ansible/pull/82293
- https://github.com/mitogen-hq/mitogen/wiki/AnsibleUnsafe-notes
1 month ago
Alex Willmer 813f253d6b ansible_mitogen: Make ansible_mitogens.utils a package
Prep work for ansible_mitogen.utils.unsafe
1 month ago
Orion Poplawski dfc3c7d516 ansible_mitogen: Add Ansible 7 support
Co-authored-by: Orion Poplawski <orion@nwra.com>
1 month ago
Alex Willmer fe8a3a71fc ansible_mitogen: Remove use of distutils, which was removed in Python 3.12 2 months ago
Alex Willmer 5ad3d14ceb mitogen: Support PEP 451 ModuleSpec API, required for Python 3.12
importlib.machinery.ModuleSpec and find_spec() were introduced in Python 3.4
under PEP 451. They replace the find_module() API of PEP 302, which was
deprecated from Python 3.4. They were removed in Python 3.12 along with the
imp module.

This change adds support for the PEP 451 APIs. Mitogen should no longer import
imp on Python versions that support ModuleSpec. Tests have been added to cover
the new APIs.

CI jobs have been added to cover Python 3.x on macOS.

Refs #1033
Co-authored-by: Witold Baryluk <witold.baryluk@gmail.com>
2 months ago
Alex Willmer fc3e788cb4 non functional: Add comments about imp module removal in Python 3.12 3 months ago
InsanePrawn 317a2abd57 ansible_mitogen: correct typo in MitogenViaSpec.mitogen_lxc_path()
self.host_vars -> self._host_vars
1 year ago
Alex Willmer 1871f2a9b1 Remove vendored mitogen.compat.simplejson
Python 2.6 added json to the stdlib. We no longer support Python <= 2.7 in
Mitogen 0.3.x, so this fallback is unneeded complexity. Fixes #659
1 year ago
Alex Willmer 0af2ce8c30 Remove ansible_mitogen Connection.close() workaround
Refs #925 #969

I'm not 100% confident that merely removing this is the full fix,
without substituting something else. I am sure keeping it would be
the greater of two evils. __del__() should be avoided on general
principal, and it's associated with multiple intermittant CI
failures, plus multiple user reported issues.
2 years ago
Artem Nistratov 00dab14111 add SSH args into options documentation 2 years ago
Alex Willmer f1503874de ansible_mitogen: Correct ansible_become_pass/ansible_become_password precendence
Until Ansible 2.9 it looks like ansible_become_password had higher priority.
From Ansible 2.10 ansible_become_pass has higher priority [1]. Mitogen was not
respecting this.

I may need to rework this further, instatiating the become plugin may have
slowed down execution.

[1] Based on testing with

```
[ubuntus]
become-pass-pass ansible_become_pass=1234
become-pass-password ansible_become_password=1234
become-pass-both ansible_become_password=wrong ansible_become_pass=1234

[ubuntus:vars]
ansible_host=ubuntu2004.local
ansible_user=ubuntu
```
```
- hosts: ubuntus
  gather_facts: false
  become: true
  tasks:
    - ping:
```
2 years ago
Alex Willmer e8ad12e881 Ansible 6 support
fixes #929
2 years ago
David Mehren a30a743ce7 Add ansible.builtin.dnf to ALWAYS_FORK_MODULES
The new fully qualified name of the DNF module needs to also be added to the list.

Fixes #832
2 years ago
Alex Willmer 25ea6dde02 ansible_mitogen: Allow mitogen_fetch to bypass slurp module
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
2 years ago
Alex Willmer 0ff9c6e579 ansible_mitogen: Replace fetch action plug from upstream
From
be0cdc0ea2/lib/ansible/plugins/action/fetch.py
2 years ago
Alex Willmer 31b3a4eb4a ansible_mitogen: Standardise __future__ imports to match Ansible
Some modules additionally enable unicode_literals (which Ansible doesn't do).
I've chosen not to change that, for now.
2 years ago
Alex Willmer 109feec6d5 Fix lints found by flake8 2 years ago
Alex Willmer 18c89de5a9 Remove unused module imports 2 years ago
Alex Willmer 96e20a09d6 ansible_mitogen: Add podman connection plugin 2 years ago
Alex Willmer 1287d58a54 Use with open(): ... to ensure file objects get closed 2 years ago
Klaus Zerwes 6fb5502a35 issue #874 support for ansible core 2.12 aka. ansible community 5.0 2 years ago
Alex Willmer d9b8d50d4e Fix ansible.__version__ comparisons with multi-digit components
Ansible 2.8 is older than Ansible 2.10, but `'2.8' < '2.10' == False`
2 years ago
Alex Willmer 465ac8abff ansible: Fix AttributeError in kubectl connection 2 years ago
Alex Willmer e194a6367f ci: Fix version comparisons involving double digits
See https://gist.github.com/moreati/e7507c5b606b12ec0ddafcb7c8debbf1
2 years ago
Alex Willmer c61c063b4f Support for Ansible 3 & 4
fixes #834

Co-authored-by: Claude Becker (@upekkha)
Co-authored-by: Dolph Mathews (@dolph)
3 years ago
Alex Willmer 2382d8dab5
Merge branch 'master' into issue_827_collections 3 years ago
Antti Jaakkola ee6f2b09b9 Fix for load_plugins() called twice error with dnf 3 years ago
Philippe Kueck a2dcedabda
fixes #827
some ansible collections write their own module classes derived from
ansible.module_utils.basic.AnsibleModule, thus lacking that import
in the plugin file. NewStylePlanner was unable to detect these plugins
as Ansiballz.

This commit extends the search pattern for NewStylePlanner to also
detect ansible_collections imports.
3 years ago
Steven Robertson 234dde5fc1 check Ansible version before loaders are loaded 3 years ago
Steven Robertson ba222744af
Merge branch 'master' into add0.2.10+0.3.0changelog 3 years ago
MarkusTeufelberger 8d3026b109
Add ansible.legacy.setup to be fixed on py3.5 3 years ago
Steven Robertson f489478127 code cleanup + adds 0.2.10 + 0.3.0 changelog 3 years ago
Steven Robertson 2510f1a2c2 fix py3.5.1-3.5.3 setup import error for Ansible 2.10 4 years ago
Steven Robertson 5a0da02e6c code review changes, using when statements and adding trailing comma 4 years ago
Steven Robertson 196a476270 🎉 no more warnings, only load specific collection subdirs instead of top-level collection path (ie no ansible_collections/google, only ansible_collections/google/cloud, etc) 4 years ago
Steven Robertson 741e99f698 ansible 2.10 no longer has a at the end of the error msg... 🤦 4 years ago
Steven Robertson 95c43ec9fc fixed issue of switching between mitogen and non-mitogen strategies 4 years ago
Steven Robertson e30e84334e remove synchronize fail test for azure 4 years ago
Steven Robertson 139b9560bc print didn't work because verbosity, throw valueerror to see 4 years ago
Steven Robertson 9bd35adcfb more debugging, synchronize is being weird on azure 4 years ago
Steven Robertson ff8a276186 turn off failing Ansible-only tests for now, also raising errors to see what Azure is gonna do with collections 4 years ago
Steven Robertson f757dbcb82 removed duplicate install and added debug dump of collection loading to see what tests are doing 4 years ago
Steven Robertson 41a13ebce2 hopefully this also fails the same way 4 years ago
Steven Robertson 5aedb5f157 add missing collections 🤦 4 years ago
Steven Robertson 9857dfea5c verify collection is working as expected 4 years ago
Steven Robertson a40c28d93f can't replicate but think it's because synchronize is now a collection 4 years ago