mitogen icon indicating copy to clipboard operation
mitogen copied to clipboard

ansible_mitogen: become_method doesn't support fully qualified collection name (FQCN)

Open jadacyrus opened this issue 11 months ago • 1 comments

According to ansible-lint the correct value for become_method su and sudo are the fully qualified names ansible.builtin.su and ansible.builtin.sudo (https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/schemas/ansible.json#L48)

Making the switch to these fully qualified names while using the Mitogen connection strategy produces the following error :

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'ansible.builtin.sudo'
fatal: [REDACTED]: FAILED! =>
  msg: 'Unexpected failure during module execution: ''ansible.builtin.sudo'''
  stdout: ''

Here is an example playbook that will reproduce the bug:

# test-playbook.yml
- hosts: localhost
  tasks:
    - name: Run a shell command
      ansible.builtin.command: /bin/echo $(id -un)
      become: true
      become_user: nobody
      become_method: ansible.builtin.sudo

PR is here: https://github.com/mitogen-hq/mitogen/pull/1072

jadacyrus avatar Jan 28 '25 12:01 jadacyrus

I should have said, the changelog entry can use the PR ID. A seperate issue isn't required. Feel free to use either though.

moreati avatar Jan 28 '25 12:01 moreati