Skip to content

Commit

Permalink
Add support for fully qualified connection names in become_method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadacyrus committed Jan 28, 2025
1 parent 45472c6 commit c481965
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ansible_mitogen/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ def _connect_mitogen_doas(spec):
'ssh': _connect_ssh,
'smart': _connect_ssh, # issue #548.
'su': _connect_su,
'ansible.builtin.su': _connect_su,
'sudo': _connect_sudo,
'ansible.builtin.sudo': _connect_sudo,
'doas': _connect_doas,
'mitogen_su': _connect_mitogen_su,
'mitogen_sudo': _connect_mitogen_sudo,
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ To avail of fixes in an unreleased version, please download a ZIP file
In progress (unreleased)
------------------------

* :gh:issue:`1232` :mod:`ansible_mitogen`: Add support for fully qualified
connection names in become_method
* :gh:issue:`1213` tests: Enable default Python warnings
* :gh:issue:`1111` :mod:`mitogen`: Replace uses of deprecated
:py:func:`pkgutil.find_loader`
Expand Down
1 change: 1 addition & 0 deletions tests/ansible/regression/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
- import_playbook: issue_1066__add_host__host_key_checking.yml
- import_playbook: issue_1079__wait_for_connection_timeout.yml
- import_playbook: issue_1087__template_streamerror.yml
- import_playbook: issue_1232__fully_qualified_names_become_method.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: regression/issue_1232__fully_qualified_names_become_method.yml (1/2)
hosts: test-targets
become_method: ansible.builtin.sudo
tasks:
- name: Run a shell command with sudo root
vars:
ansible_become_pass: rootpassword
ansible.builtin.command: whoami
become: true
become_user: root

- name: regression/issue_1232__fully_qualified_names_become_method.yml (2/2)
hosts: test-targets
become_method: ansible.builtin.su
tasks:
- name: Run a shell command with su mitogen__user1
vars:
ansible_become_pass: user1_password
when:
- become_unpriv_available
ansible.builtin.command: whoami
become: true
become_user: mitogen__user1

0 comments on commit c481965

Please sign in to comment.