Skip to content

Commit 1f1d724

Browse files
committed
WIP
1 parent 2f301ef commit 1f1d724

File tree

14 files changed

+65
-128
lines changed

14 files changed

+65
-128
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,57 +24,6 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
include:
27-
- name: Ans_27_210
28-
tox_env: py27-mode_ansible-ansible2.10
29-
- name: Ans_27_4
30-
tox_env: py27-mode_ansible-ansible4
31-
32-
- name: Ans_36_210
33-
python_version: '3.6'
34-
tox_env: py36-mode_ansible-ansible2.10
35-
- name: Ans_36_4
36-
python_version: '3.6'
37-
tox_env: py36-mode_ansible-ansible4
38-
39-
- name: Ans_311_210
40-
python_version: '3.11'
41-
tox_env: py311-mode_ansible-ansible2.10
42-
- name: Ans_311_3
43-
python_version: '3.11'
44-
tox_env: py311-mode_ansible-ansible3
45-
- name: Ans_311_4
46-
python_version: '3.11'
47-
tox_env: py311-mode_ansible-ansible4
48-
- name: Ans_311_5
49-
python_version: '3.11'
50-
tox_env: py311-mode_ansible-ansible5
51-
- name: Ans_313_6
52-
python_version: '3.13'
53-
tox_env: py313-mode_ansible-ansible6
54-
- name: Ans_313_7
55-
python_version: '3.13'
56-
tox_env: py313-mode_ansible-ansible7
57-
- name: Ans_313_8
58-
python_version: '3.13'
59-
tox_env: py313-mode_ansible-ansible8
60-
- name: Ans_313_9
61-
python_version: '3.13'
62-
tox_env: py313-mode_ansible-ansible9
63-
- name: Ans_313_10
64-
python_version: '3.13'
65-
tox_env: py313-mode_ansible-ansible10
66-
- name: Ans_313_11
67-
python_version: '3.13'
68-
tox_env: py313-mode_ansible-ansible11
69-
- name: Van_313_11
70-
python_version: '3.13'
71-
tox_env: py313-mode_ansible-ansible11-strategy_linear
72-
73-
- name: Mito_27
74-
tox_env: py27-mode_mitogen
75-
- name: Mito_36
76-
python_version: '3.6'
77-
tox_env: py36-mode_mitogen
7827
- name: Mito_313
7928
python_version: '3.13'
8029
tox_env: py313-mode_mitogen
@@ -167,15 +116,9 @@ jobs:
167116
fail-fast: false
168117
matrix:
169118
include:
170-
- name: Mito_313
171-
tox_env: py313-mode_mitogen
172-
173119
- name: Loc_313_11
174120
tox_env: py313-mode_localhost-ansible11
175121

176-
- name: Van_313_11
177-
tox_env: py313-mode_localhost-ansible11-strategy_linear
178-
179122
steps:
180123
- uses: actions/checkout@v4
181124
- uses: actions/setup-python@v5

mitogen/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _path_importer_cache(cls, path):
5555
return None
5656
return super()._path_importer_cache(path)
5757

58-
if sys.version_info[:2] <= (3, 12):
58+
if sys.version_info[:2] <= (3, 13): # I don't expect this workaround to work on 3.13, just ruling it out.
5959
for i, mpf in enumerate(sys.meta_path):
6060
if mpf is _frozen_importlib_external.PathFinder:
6161
sys.meta_path[i] = MonkeyPatchedPathFinder
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
---
2+
become_unpriv_available: >-
3+
{#
4+
Vanilla Ansible >= 4 (ansible-core >= 2.11) can use `setfacl` for
5+
unpriv -> unpriv, but Mitogen test containers lack setfacl
6+
https://github.com/mitogen-hq/mitogen/issues/1118
7+
8+
Mitogen + Ansible can do unpriv -> unpriv without temporary files,
9+
but Ansible >= 11 (ansible-core >= 2.18) detection tries to use Python
10+
3.13 which hits https://github.com/python/cpython/issues/115911 on macOS.
11+
#}
12+
{{-
13+
(
14+
not is_mitogen
15+
and ansible_facts.distribution in ["MacOSX"]
16+
and ansible_version.full is version("2.11", ">=", strict=True)
17+
)
18+
or (
19+
is_mitogen
20+
and not ansible_facts.distribution in ["MacOSX"]
21+
)
22+
or (
23+
is_mitogen
24+
and ansible_python_interpreter is not defined
25+
and ansible_version.full is version("2.18", "<", strict=True)
26+
)
27+
-}}
28+
229
pkg_mgr_python_interpreter: python
330
pkg_repos_overrides: []

tests/ansible/integration/action/make_tmp_path.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@
142142
# readonly homedir
143143
#
144144

145+
- name: Confirm readonly_homedir state
146+
become: true
147+
shell: stat ~mitogen__readonly_homedir
148+
register: stat_home_mitogen__readonly_homedir
149+
- debug:
150+
var: stat_home_mitogen__readonly_homedir
151+
145152
- name: Try writing to temp directory for the readonly_homedir user
146153
become: true
147154
become_user: mitogen__readonly_homedir
@@ -152,6 +159,11 @@
152159
result['path'] = path
153160
open(path, 'w').write("bar")
154161
register: tmp_path
162+
# Possibly hitting https://github.com/python/cpython/issues/115911
163+
# with Python 3.13 + macOS + Ansible 11
164+
when:
165+
- ansible_version.full is version('2.18', '<', strict=True)
166+
or not is_mitogen
155167

156168
#
157169
# modules get the same base dir

tests/ansible/integration/become/su_password.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,15 @@
5555
vars:
5656
ansible_become_pass: user1_password
5757
when:
58-
# CI containers lack `setfacl` for unpriv -> unpriv
59-
# https://github.com/mitogen-hq/mitogen/issues/1118
60-
- is_mitogen
61-
or (ansible_facts.distribution in ["MacOSX"]
62-
and ansible_version.full is version("2.11", ">=", strict=True))
58+
- become_unpriv_available
6359

6460
- assert:
6561
that:
6662
- out.stdout == 'mitogen__user1'
6763
fail_msg: |
6864
out={{ out }}
6965
when:
70-
# CI containers lack `setfacl` for unpriv -> unpriv
71-
# https://github.com/mitogen-hq/mitogen/issues/1118
72-
- is_mitogen
73-
or (ansible_facts.distribution in ["MacOSX"]
74-
and ansible_version.full is version("2.11", ">=", strict=True))
66+
- become_unpriv_available
7567

7668
- name: Ensure password su without chdir succeeds
7769
shell: whoami
@@ -81,23 +73,15 @@
8173
vars:
8274
ansible_become_pass: user1_password
8375
when:
84-
# CI containers lack `setfacl` for unpriv -> unpriv
85-
# https://github.com/mitogen-hq/mitogen/issues/1118
86-
- is_mitogen
87-
or (ansible_facts.distribution in ["MacOSX"]
88-
and ansible_version.full is version("2.11", ">=", strict=True))
76+
- become_unpriv_available
8977

9078
- assert:
9179
that:
9280
- out.stdout == 'mitogen__user1'
9381
fail_msg: |
9482
out={{ out }}
9583
when:
96-
# CI containers lack `setfacl` for unpriv -> unpriv
97-
# https://github.com/mitogen-hq/mitogen/issues/1118
98-
- is_mitogen
99-
or (ansible_facts.distribution in ["MacOSX"]
100-
and ansible_version.full is version("2.11", ">=", strict=True))
84+
- become_unpriv_available
10185

10286
tags:
10387
- su

tests/ansible/integration/become/sudo_nonexistent.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
ignore_errors: true
1010
register: out
1111
when:
12-
# https://github.com/ansible/ansible/pull/70785
13-
- ansible_facts.distribution not in ["MacOSX"]
14-
or ansible_version.full is version("2.11", ">=", strict=True)
15-
or is_mitogen
12+
- become_unpriv_available
1613

1714
- name: Verify raw module output.
1815
assert:
@@ -26,10 +23,7 @@
2623
fail_msg: |
2724
out={{ out }}
2825
when:
29-
# https://github.com/ansible/ansible/pull/70785
30-
- ansible_facts.distribution not in ["MacOSX"]
31-
or ansible_version.full is version("2.11", ">=", strict=True)
32-
or is_mitogen
26+
- become_unpriv_available
3327
tags:
3428
- sudo
3529
- sudo_nonexistent

tests/ansible/integration/become/sudo_password.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
changed_when: false
1414
ignore_errors: true
1515
when:
16-
# https://github.com/ansible/ansible/pull/70785
17-
- ansible_facts.distribution not in ["MacOSX"]
18-
or ansible_version.full is version("2.11", ">=", strict=True)
19-
or is_mitogen
16+
- become_unpriv_available
2017

2118
- assert:
2219
that: |
@@ -28,10 +25,7 @@
2825
fail_msg: |
2926
out={{ out }}
3027
when:
31-
# https://github.com/ansible/ansible/pull/70785
32-
- ansible_facts.distribution not in ["MacOSX"]
33-
or ansible_version.full is version("2.11", ">=", strict=True)
34-
or is_mitogen
28+
- become_unpriv_available
3529

3630
- name: Ensure password sudo incorrect.
3731
become: true
@@ -44,10 +38,7 @@
4438
ansible_become_pass: nopes
4539
ignore_errors: true
4640
when:
47-
# https://github.com/ansible/ansible/pull/70785
48-
- ansible_facts.distribution not in ["MacOSX"]
49-
or ansible_version.full is version("2.11", ">=", strict=True)
50-
or is_mitogen
41+
- become_unpriv_available
5142

5243
- assert:
5344
that: |
@@ -58,10 +49,7 @@
5849
fail_msg: |
5950
out={{ out }}
6051
when:
61-
# https://github.com/ansible/ansible/pull/70785
62-
- ansible_facts.distribution not in ["MacOSX"]
63-
or ansible_version.full is version("2.11", ">=", strict=True)
64-
or is_mitogen
52+
- become_unpriv_available
6553

6654
- block:
6755
- name: Ensure password sudo succeeds
@@ -80,10 +68,7 @@
8068
fail_msg: |
8169
sudo_password_success_whoami={{ sudo_password_success_whoami }}
8270
when:
83-
# https://github.com/ansible/ansible/pull/70785
84-
- ansible_facts.distribution not in ["MacOSX"]
85-
or ansible_version.full is version("2.11", ">=", strict=True)
86-
or is_mitogen
71+
- become_unpriv_available
8772
tags:
8873
- sudo
8974
- sudo_password

tests/ansible/integration/become/sudo_requiretty.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@
1313
cmd: whoami
1414
changed_when: false
1515
register: sudo_require_tty_whoami
16+
when:
17+
- become_unpriv_available
1618

1719
- assert:
1820
that:
1921
- sudo_require_tty_whoami.stdout == 'mitogen__require_tty'
2022
fail_msg: |
2123
sudo_require_tty_whoami={{ sudo_require_tty_whoami }}
24+
when:
25+
- become_unpriv_available
2226

2327
- name: Verify we can login to a passworded requiretty account
2428
become: true
@@ -29,12 +33,16 @@
2933
cmd: whoami
3034
changed_when: false
3135
register: sudo_require_tty_password_whoami
36+
when:
37+
- become_unpriv_available
3238

3339
- assert:
3440
that:
3541
- sudo_require_tty_password_whoami.stdout == 'mitogen__require_tty_pw_required'
3642
fail_msg: |
3743
sudo_require_tty_password_whoami={{ sudo_require_tty_password_whoami }}
44+
when:
45+
- become_unpriv_available
3846
tags:
3947
- mitogen_only
4048
- sudo

tests/ansible/integration/become/templated_by_inv.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,4 @@
2727
- become_templated_by_inv_whoami is failed
2828
or become_templated_by_inv_whoami.stdout != expected_become_users[inventory_hostname]
2929
when:
30-
# https://github.com/ansible/ansible/pull/70785
31-
- ansible_become_user in ['root']
32-
or ansible_facts.distribution not in ["MacOSX"]
33-
or ansible_version.full is version("2.11", ">=", strict=True)
34-
or is_mitogen
30+
- become_unpriv_available

tests/ansible/integration/become/templated_by_play_keywords.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,4 @@
4747
- become_templated_by_play_keywords_password_whoami is failed
4848
or become_templated_by_play_keywords_password_whoami.stdout != 'mitogen__pw_required'
4949
when:
50-
# https://github.com/ansible/ansible/pull/70785
51-
- ansible_facts.distribution not in ["MacOSX"]
52-
or ansible_version.full is version("2.11", ">=", strict=True)
53-
or is_mitogen
50+
- become_unpriv_available

0 commit comments

Comments
 (0)