Commit Graph

109 Commits (a9048f0f7d78a0752ca8cb3289afcf7659a3ec1d)

Author SHA1 Message Date
Alex Willmer e97d20c9d1 ansible_mitogen: Return stderr_lines from _low_level_execute_command()
Vanilla Ansible has returned stderr since v1.9 or earlier, stderr_lines was
added in v2.6.0 (https://github.com/ansible/ansible/pull/40079).
10 months ago
Alex Willmer 51c7b789f7 ansible_mitogen: Decouple possible_pythons order & error handling
'python' could now be tried earlier, or not at all.
10 months ago
Alex Willmer 356be2e65f ansible_mitogen: Remove unneeded internal _run_cmd() 10 months ago
Alex Willmer 1b8b2c8b1a ansible_mitogen: Rename Mitogen interpreter discovery attributes
This makes their nature and ownership/responsibility much more explicit.
10 months ago
Alex Willmer d3da3ff769 ansible_mitogen: Don't redeclare interpreter discovery attributes
Duplicated effort on Ansible 2.10, and a potential source of future error
10 months ago
Alex Willmer bf6607e27e ansible_mitogen: Support templated become_user
This reads the become username from the `become_user` attribute of the play
context, to the `"become_user"` option of the loaded become plugin. This has
been supported by vanilla Ansible since Ansible 2.10 (ansible-base 2.10).

To support this I've also switched from using the `play_context.become` (a
bool), to `connection.become` (an instance of the appropriate) become plugin.

New tests have been added, modelled on those for templated connection
parameters (see #1147, #1153, #1159).

See
- 480b106d65

refs #1083

Co-authored-by: mordek <m.pirog@bonasoft.pl>
1 year ago
Alex Willmer 90ba0a74eb ansible_mitogen: Remove unused imports 1 year ago
Alex Willmer 34088a8b7f ansible_mitogen: Consolidate Python 2 & 3 compatibility
Rough guidelines, in decending preference:
- Use mitogen.core if possible
- Use ansible.module_utils.six if possible
- Embed a getattr() or try/except

viewkeys() et al can't be brought into mitogen.core because that package still
targets Python 2.4. dict.viewkeys() were introduced in Python 2.7.
1 year ago
Alex Willmer 0a908d76da ansible_mitogen: Remove fallback imports for Ansible < 2.10 1 year ago
Jonathan Rosser 06617f8231 ansible_mitogen: Handle unsafe paths in _remote_chmod
This is missing from b822f20007
1 year ago
Alex Willmer 357fe38766 Ansible 10 (ansible-core 2.17) support
Notably
- Python 2.7 and 3.6 are no longer supported by Ansible on targets
- The yum module has been removed, and redirected to dnf
- _INTERPRETER_PYTHON_DISTRO_MAP has been neutered. Interpreter discovery
  always favours specific `python3.<x>` interpreters in decending version
  order, then generic `python3` or `python`.
- Add the ability for an action plugin to call self._execute_module(*,
  ignore_unknown_opts=True) to execute a module with options that may not be
  supported for the version being called.

https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_10.html
https://github.com/ansible-community/ansible-build-data/blob/main/10/CHANGELOG-v10.md
https://github.com/ansible/ansible/blob/stable-2.17/changelogs/CHANGELOG-v2.17.rst

fixes #1074, refs #1082

Co-authored-by: Claude Becker <becker@phys.ethz.ch>
1 year 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
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.
4 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`
4 years ago
Steven Robertson e30e84334e remove synchronize fail test for azure 5 years ago
Steven Robertson 139b9560bc print didn't work because verbosity, throw valueerror to see 5 years ago
Steven Robertson 9bd35adcfb more debugging, synchronize is being weird on azure 5 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 5 years ago
Steven Robertson 41a13ebce2 hopefully this also fails the same way 5 years ago
Steven Robertson 5aedb5f157 add missing collections 🤦 5 years ago
Steven Robertson 9857dfea5c verify collection is working as expected 5 years ago
Steven Robertson a40c28d93f can't replicate but think it's because synchronize is now a collection 5 years ago
Steven Robertson 49dd8eee1a figure out what synchronize is now 5 years ago
Steven Robertson c6d42212dd add some debugging info, was able to run the failed synchronize test locally just fine using test framework, not sure what's going on 5 years ago
Steven Robertson f91cbf4d00 test cleanup and trying to replicate synchronize fails 5 years ago
Steven Robertson f994807d74 ansible 2.10 renamed ping module to reflect legacy builtin collection 5 years ago
Steven Robertson 03438271bb able to remove the hack on ActionBase after all 5 years ago
Steven Robertson 583f540889 added comments 5 years ago
Steven Robertson ddc1eebec8 able to load collection but the mitogen master proc was unable to serve it 6 years ago
Steven Robertson e99d63f4fc able to load collections but they don't do anything because no actionmodulemixin, need to tweak how this works 6 years ago
Steven Robertson acde13f9d6 handles a 'wait_for_connection' call right after a task caused a shutdown 6 years ago
Steven Robertson 5bf327649f add missing / to python paths 6 years ago
Steven Robertson 7411057ba8 adding in python3 as a possible_pythons option for rhel8 6 years ago
Steven Robertson 89d87445c8 able to pass tests running interpreter detection in rhel8 container 6 years ago
Steven Robertson 7d6d76e444 trying to get docker rhel8 working on a Mac host 6 years ago
Steven Robertson ee310c1a68 remove_internal_keys returns None, so need different way to check fallback 6 years ago
Steven Robertson 722cf0ea8d handle ansible 2.3.3 remove_internal_keys 6 years ago
Steven Robertson ba350aa6cf assigned interpreter vars to the wrong class 6 years ago
Steven Robertson d74da84f62 the clean module was added later 6 years ago
Steven Robertson ff2fa60184 fixed typo 6 years ago
Steven Robertson 0b57332d75 all test cases for ansible_python_interpreter on OSX pass now 6 years ago
Steven Robertson af1e22d4e1 able to propagate ansible_python_interpreter fact but still doesn't save between task runs 6 years ago
Steven Robertson a6d2b2cd90 doesn't error when declaring 'ansible_python_interpreter: auto' but fact isn't being cached 6 years ago
Steven Robertson d64adb15d7 reverted autolinted code 6 years ago
Steven Robertson e8f3154cab Merge branch 'master' into complexAnsiblePythonInterpreterArg 6 years ago
David Wilson d6329f3446 Merge devel/290 @ 79b979ec8544ef5d8620c64068d4a42fabf50415 6 years ago
Steven Robertson 4669c8774f handles templating ansible_python_interpreter values 6 years ago
David Wilson 8dfb3966df issue #558, #582: preserve remote tmpdir if caller did not supply one
The undocumented 'tmp' parameter controls whether _execute_module()
would delete anything on 2.3, so mimic that. This means
_execute_remove_stat() calls will not blow away the temp directory,
which broke the unarchive plugin.
6 years ago
David Wilson c80fddd487 [linear2]: merge fallout flaggged by LGTM 6 years ago
David Wilson 6309774be2 issue #554: fix Ansible 2.4 compatibility 7 years ago