Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible 11 (ansible-core 2.18) #1177

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 2 additions & 56 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,54 +24,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: Ans_27_210
tox_env: py27-mode_ansible-ansible2.10
- name: Ans_27_4
tox_env: py27-mode_ansible-ansible4

- name: Ans_36_210
python_version: '3.6'
tox_env: py36-mode_ansible-ansible2.10
- name: Ans_36_4
python_version: '3.6'
tox_env: py36-mode_ansible-ansible4

- name: Ans_311_210
python_version: '3.11'
tox_env: py311-mode_ansible-ansible2.10
- name: Ans_311_3
python_version: '3.11'
tox_env: py311-mode_ansible-ansible3
- name: Ans_311_4
python_version: '3.11'
tox_env: py311-mode_ansible-ansible4
- name: Ans_311_5
python_version: '3.11'
tox_env: py311-mode_ansible-ansible5
- name: Ans_313_6
python_version: '3.13'
tox_env: py313-mode_ansible-ansible6
- name: Ans_313_7
python_version: '3.13'
tox_env: py313-mode_ansible-ansible7
- name: Ans_313_8
python_version: '3.13'
tox_env: py313-mode_ansible-ansible8
- name: Ans_313_9
python_version: '3.13'
tox_env: py313-mode_ansible-ansible9
- name: Ans_313_10
python_version: '3.13'
tox_env: py313-mode_ansible-ansible10
- name: Van_313_10
python_version: '3.13'
tox_env: py313-mode_ansible-ansible10-strategy_linear

- name: Mito_27
tox_env: py27-mode_mitogen
- name: Mito_36
python_version: '3.6'
tox_env: py36-mode_mitogen
- name: Mito_313
python_version: '3.13'
tox_env: py313-mode_mitogen
Expand Down Expand Up @@ -164,14 +116,8 @@ jobs:
fail-fast: false
matrix:
include:
- name: Mito_313
tox_env: py313-mode_mitogen

- name: Loc_313_10
tox_env: py313-mode_localhost-ansible10

- name: Van_313_10
tox_env: py313-mode_localhost-ansible10-strategy_linear
- name: Loc_313_11
tox_env: py313-mode_localhost-ansible11

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


ANSIBLE_VERSION_MIN = (2, 10)
ANSIBLE_VERSION_MAX = (2, 17)
ANSIBLE_VERSION_MAX = (2, 18)

NEW_VERSION_MSG = (
"Your Ansible version (%s) is too recent. The most recent version\n"
Expand Down
2 changes: 2 additions & 0 deletions docs/ansible_detailed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ Noteworthy Differences
+-----------------+ 3.10 - 3.13 |
| 10 | |
+-----------------+-----------------+
| 11 | 3.11 - 3.13 |
+-----------------+-----------------+

Verify your installation is running one of these versions by checking
``ansible --version`` output.
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ To avail of fixes in an unreleased version, please download a ZIP file
In progress (unreleased)
------------------------

* :gh:issue:`1129` :mod:`ansible_mitogen`: Ansible 11 support


v0.3.18 (2024-11-07)
Expand Down
2 changes: 1 addition & 1 deletion mitogen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _path_importer_cache(cls, path):
return None
return super()._path_importer_cache(path)

if sys.version_info[:2] <= (3, 12):
if sys.version_info[:2] <= (3, 13): # I don't expect this workaround to work on 3.13, just ruling it out.
for i, mpf in enumerate(sys.meta_path):
if mpf is _frozen_importlib_external.PathFinder:
sys.meta_path[i] = MonkeyPatchedPathFinder
Expand Down
12 changes: 12 additions & 0 deletions tests/ansible/integration/action/make_tmp_path.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@
# readonly homedir
#

- name: Confirm readonly_homedir state
become: true
shell: stat ~mitogen__readonly_homedir
register: stat_home_mitogen__readonly_homedir
- debug:
var: stat_home_mitogen__readonly_homedir

- name: Try writing to temp directory for the readonly_homedir user
become: true
become_user: mitogen__readonly_homedir
Expand All @@ -152,6 +159,11 @@
result['path'] = path
open(path, 'w').write("bar")
register: tmp_path
# Possibly hitting https://github.com/python/cpython/issues/115911
# with Python 3.13 + macOS + Ansible 11
when:
- ansible_version.full is version('2.18', '<', strict=True)
or not is_mitogen

#
# modules get the same base dir
Expand Down
88 changes: 72 additions & 16 deletions tests/ansible/integration/become/su_password.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,51 @@
vars:
ansible_become_pass: user1_password
when:
# CI containers lack `setfacl` for unpriv -> unpriv
# Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
# unpriv -> unpriv, but Mitogen test containers lack setfacl
# https://github.com/mitogen-hq/mitogen/issues/1118
- is_mitogen
or (ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True))
# Mitogen + Ansible can do unpriv -> unpriv without temporary files,
# but Ansible >= 11 (ansible-core >= 2.18) tries to use Python 3.13
# which hits https://github.com/python/cpython/issues/115911 on macOS
- (
not is_mitogen
and ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True)
)
or (
is_mitogen
and not ansible_facts.distribution in ["MacOSX"]
)
or (
is_mitogen
and ansible_version.full is version("2.18", "<", strict=True)
)

- assert:
that:
- out.stdout == 'mitogen__user1'
fail_msg: |
out={{ out }}
when:
# CI containers lack `setfacl` for unpriv -> unpriv
# Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
# unpriv -> unpriv, but Mitogen test containers lack setfacl
# https://github.com/mitogen-hq/mitogen/issues/1118
- is_mitogen
or (ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True))
# Mitogen + Ansible can do unpriv -> unpriv without temporary files,
# but Ansible >= 11 (ansible-core >= 2.18) tries to use Python 3.13
# which hits https://github.com/python/cpython/issues/115911 on macOS
- (
not is_mitogen
and ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True)
)
or (
is_mitogen
and not ansible_facts.distribution in ["MacOSX"]
)
or (
is_mitogen
and ansible_version.full is version("2.18", "<", strict=True)
)

- name: Ensure password su without chdir succeeds
shell: whoami
Expand All @@ -81,23 +109,51 @@
vars:
ansible_become_pass: user1_password
when:
# CI containers lack `setfacl` for unpriv -> unpriv
# Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
# unpriv -> unpriv, but Mitogen test containers lack setfacl
# https://github.com/mitogen-hq/mitogen/issues/1118
- is_mitogen
or (ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True))
# Mitogen + Ansible can do unpriv -> unpriv without temporary files,
# but Ansible >= 11 (ansible-core >= 2.18) tries to use Python 3.13
# which hits https://github.com/python/cpython/issues/115911 on macOS
- (
not is_mitogen
and ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True)
)
or (
is_mitogen
and not ansible_facts.distribution in ["MacOSX"]
)
or (
is_mitogen
and ansible_version.full is version("2.18", "<", strict=True)
)

- assert:
that:
- out.stdout == 'mitogen__user1'
fail_msg: |
out={{ out }}
when:
# CI containers lack `setfacl` for unpriv -> unpriv
# Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
# unpriv -> unpriv, but Mitogen test containers lack setfacl
# https://github.com/mitogen-hq/mitogen/issues/1118
- is_mitogen
or (ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True))
# Mitogen + Ansible can do unpriv -> unpriv without temporary files,
# but Ansible >= 11 (ansible-core >= 2.18) tries to use Python 3.13
# which hits https://github.com/python/cpython/issues/115911 on macOS
- (
not is_mitogen
and ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True)
)
or (
is_mitogen
and not ansible_facts.distribution in ["MacOSX"]
)
or (
is_mitogen
and ansible_version.full is version("2.18", "<", strict=True)
)

tags:
- su
Expand Down
46 changes: 38 additions & 8 deletions tests/ansible/integration/become/sudo_nonexistent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,25 @@
ignore_errors: true
register: out
when:
# https://github.com/ansible/ansible/pull/70785
- ansible_facts.distribution not in ["MacOSX"]
or ansible_version.full is version("2.11", ">=", strict=True)
or is_mitogen
# Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
# unpriv -> unpriv, but Mitogen test containers lack setfacl
# https://github.com/mitogen-hq/mitogen/issues/1118
# Mitogen + Ansible can do unpriv -> unpriv without temporary files,
# but Ansible >= 11 (ansible-core >= 2.18) tries to use Python 3.13
# which hits https://github.com/python/cpython/issues/115911 on macOS
- (
not is_mitogen
and ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True)
)
or (
is_mitogen
and not ansible_facts.distribution in ["MacOSX"]
)
or (
is_mitogen
and ansible_version.full is version("2.18", "<", strict=True)
)

- name: Verify raw module output.
assert:
Expand All @@ -26,10 +41,25 @@
fail_msg: |
out={{ out }}
when:
# https://github.com/ansible/ansible/pull/70785
- ansible_facts.distribution not in ["MacOSX"]
or ansible_version.full is version("2.11", ">=", strict=True)
or is_mitogen
# Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
# unpriv -> unpriv, but Mitogen test containers lack setfacl
# https://github.com/mitogen-hq/mitogen/issues/1118
# Mitogen + Ansible can do unpriv -> unpriv without temporary files,
# but Ansible >= 11 (ansible-core >= 2.18) tries to use Python 3.13
# which hits https://github.com/python/cpython/issues/115911 on macOS
- (
not is_mitogen
and ansible_facts.distribution in ["MacOSX"]
and ansible_version.full is version("2.11", ">=", strict=True)
)
or (
is_mitogen
and not ansible_facts.distribution in ["MacOSX"]
)
or (
is_mitogen
and ansible_version.full is version("2.18", "<", strict=True)
)
tags:
- sudo
- sudo_nonexistent
Loading