Skip to content

Commit c481965

Browse files
committed
Add support for fully qualified connection names in become_method.
1 parent 45472c6 commit c481965

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

ansible_mitogen/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ def _connect_mitogen_doas(spec):
422422
'ssh': _connect_ssh,
423423
'smart': _connect_ssh, # issue #548.
424424
'su': _connect_su,
425+
'ansible.builtin.su': _connect_su,
425426
'sudo': _connect_sudo,
427+
'ansible.builtin.sudo': _connect_sudo,
426428
'doas': _connect_doas,
427429
'mitogen_su': _connect_mitogen_su,
428430
'mitogen_sudo': _connect_mitogen_sudo,

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ To avail of fixes in an unreleased version, please download a ZIP file
2121
In progress (unreleased)
2222
------------------------
2323

24+
* :gh:issue:`1232` :mod:`ansible_mitogen`: Add support for fully qualified
25+
connection names in become_method
2426
* :gh:issue:`1213` tests: Enable default Python warnings
2527
* :gh:issue:`1111` :mod:`mitogen`: Replace uses of deprecated
2628
:py:func:`pkgutil.find_loader`

tests/ansible/regression/all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
- import_playbook: issue_1066__add_host__host_key_checking.yml
2020
- import_playbook: issue_1079__wait_for_connection_timeout.yml
2121
- import_playbook: issue_1087__template_streamerror.yml
22+
- import_playbook: issue_1232__fully_qualified_names_become_method.yml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- name: regression/issue_1232__fully_qualified_names_become_method.yml (1/2)
2+
hosts: test-targets
3+
become_method: ansible.builtin.sudo
4+
tasks:
5+
- name: Run a shell command with sudo root
6+
vars:
7+
ansible_become_pass: rootpassword
8+
ansible.builtin.command: whoami
9+
become: true
10+
become_user: root
11+
12+
- name: regression/issue_1232__fully_qualified_names_become_method.yml (2/2)
13+
hosts: test-targets
14+
become_method: ansible.builtin.su
15+
tasks:
16+
- name: Run a shell command with su mitogen__user1
17+
vars:
18+
ansible_become_pass: user1_password
19+
when:
20+
- become_unpriv_available
21+
ansible.builtin.command: whoami
22+
become: true
23+
become_user: mitogen__user1

0 commit comments

Comments
 (0)