diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index 5053a5f5b..669587a11 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -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, diff --git a/docs/changelog.rst b/docs/changelog.rst index 16f082f79..c2e5f84f1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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` diff --git a/tests/ansible/regression/all.yml b/tests/ansible/regression/all.yml index 70b5ffe77..c14225a0a 100644 --- a/tests/ansible/regression/all.yml +++ b/tests/ansible/regression/all.yml @@ -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 diff --git a/tests/ansible/regression/issue_1232__fully_qualified_names_become_method.yml b/tests/ansible/regression/issue_1232__fully_qualified_names_become_method.yml new file mode 100644 index 000000000..390084ce4 --- /dev/null +++ b/tests/ansible/regression/issue_1232__fully_qualified_names_become_method.yml @@ -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