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 ).
2025-01-23 13:44:56 +00:00
Alex Willmer
51c7b789f7
ansible_mitogen: Decouple possible_pythons order & error handling
...
'python' could now be tried earlier, or not at all.
2025-01-23 13:41:36 +00:00
Alex Willmer
356be2e65f
ansible_mitogen: Remove unneeded internal _run_cmd()
2025-01-23 13:41:35 +00:00
Alex Willmer
1b8b2c8b1a
ansible_mitogen: Rename Mitogen interpreter discovery attributes
...
This makes their nature and ownership/responsibility much more explicit.
2025-01-23 13:41:32 +00:00
Alex Willmer
d3da3ff769
ansible_mitogen: Don't redeclare interpreter discovery attributes
...
Duplicated effort on Ansible 2.10, and a potential source of future error
2025-01-23 13:40:04 +00:00
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>
2024-10-14 12:07:15 +01:00
Alex Willmer
90ba0a74eb
ansible_mitogen: Remove unused imports
2024-10-07 13:54:08 +01:00
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.
2024-09-24 17:10:07 +01:00
Alex Willmer
0a908d76da
ansible_mitogen: Remove fallback imports for Ansible < 2.10
2024-09-24 17:10:07 +01:00
Jonathan Rosser
06617f8231
ansible_mitogen: Handle unsafe paths in _remote_chmod
...
This is missing from b822f20007
2024-08-29 10:27:43 +01:00
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>
2024-08-11 16:21:05 +01:00
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
2024-04-04 09:11:23 +01:00
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.
2022-04-23 11:17:25 +01:00
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`
2021-11-22 23:19:03 +00:00
Steven Robertson
e30e84334e
remove synchronize fail test for azure
2020-10-01 22:07:28 -07:00
Steven Robertson
139b9560bc
print didn't work because verbosity, throw valueerror to see
2020-09-27 11:34:04 -07:00
Steven Robertson
9bd35adcfb
more debugging, synchronize is being weird on azure
2020-09-27 11:22:10 -07:00
Steven Robertson
ff8a276186
turn off failing Ansible-only tests for now, also raising errors to see what Azure is gonna do with collections
2020-09-20 22:10:00 -07:00
Steven Robertson
41a13ebce2
hopefully this also fails the same way
2020-09-20 20:13:47 -07:00
Steven Robertson
5aedb5f157
add missing collections 🤦
2020-09-20 18:12:58 -07:00
Steven Robertson
9857dfea5c
verify collection is working as expected
2020-09-20 18:07:25 -07:00
Steven Robertson
a40c28d93f
can't replicate but think it's because synchronize is now a collection
2020-09-20 17:57:18 -07:00
Steven Robertson
49dd8eee1a
figure out what synchronize is now
2020-09-20 17:15:29 -07:00
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
2020-09-20 16:33:03 -07:00
Steven Robertson
f91cbf4d00
test cleanup and trying to replicate synchronize fails
2020-09-20 15:40:07 -07:00
Steven Robertson
f994807d74
ansible 2.10 renamed ping module to reflect legacy builtin collection
2020-09-06 13:44:01 -07:00
Steven Robertson
03438271bb
able to remove the hack on ActionBase after all
2020-08-27 20:01:47 -07:00
Steven Robertson
583f540889
added comments
2020-08-16 00:22:08 -07:00
Steven Robertson
ddc1eebec8
able to load collection but the mitogen master proc was unable to serve it
2020-05-08 12:56:07 -07:00
Steven Robertson
e99d63f4fc
able to load collections but they don't do anything because no actionmodulemixin, need to tweak how this works
2020-05-08 12:30:44 -07:00
Steven Robertson
acde13f9d6
handles a 'wait_for_connection' call right after a task caused a shutdown
2020-04-30 17:53:06 -07:00
Steven Robertson
5bf327649f
add missing / to python paths
2020-03-20 13:16:56 -07:00
Steven Robertson
7411057ba8
adding in python3 as a possible_pythons option for rhel8
2020-03-04 10:31:43 -08:00
Steven Robertson
89d87445c8
able to pass tests running interpreter detection in rhel8 container
2020-03-03 22:03:49 -08:00
Steven Robertson
7d6d76e444
trying to get docker rhel8 working on a Mac host
2020-03-03 14:50:50 -08:00
Steven Robertson
ee310c1a68
remove_internal_keys returns None, so need different way to check fallback
2020-02-11 18:08:02 -08:00
Steven Robertson
722cf0ea8d
handle ansible 2.3.3 remove_internal_keys
2020-02-11 17:21:47 -08:00
Steven Robertson
ba350aa6cf
assigned interpreter vars to the wrong class
2020-02-11 16:25:57 -08:00
Steven Robertson
d74da84f62
the clean module was added later
2020-02-10 17:59:24 -08:00
Steven Robertson
ff2fa60184
fixed typo
2020-02-05 11:22:52 -08:00
Steven Robertson
0b57332d75
all test cases for ansible_python_interpreter on OSX pass now
2020-02-03 21:56:32 -08:00
Steven Robertson
af1e22d4e1
able to propagate ansible_python_interpreter fact but still doesn't save between task runs
2020-02-03 14:36:47 -08:00
Steven Robertson
a6d2b2cd90
doesn't error when declaring 'ansible_python_interpreter: auto' but fact isn't being cached
2020-01-31 17:08:43 -08:00
Steven Robertson
d64adb15d7
reverted autolinted code
2020-01-29 18:55:35 -08:00
Steven Robertson
e8f3154cab
Merge branch 'master' into complexAnsiblePythonInterpreterArg
2019-11-15 16:08:51 -08:00
David Wilson
d6329f3446
Merge devel/290 @ 79b979ec8544ef5d8620c64068d4a42fabf50415
2019-11-02 16:46:59 +00:00
Steven Robertson
4669c8774f
handles templating ansible_python_interpreter values
2019-10-30 13:43:48 -07:00
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.
2019-08-12 15:41:17 +01:00
David Wilson
c80fddd487
[linear2]: merge fallout flaggged by LGTM
2019-07-31 11:41:29 +01:00
David Wilson
6309774be2
issue #554 : fix Ansible 2.4 compatibility
2019-03-06 12:06:55 +00:00