From ebde01fde1fa27dd5e75bf2e4cfbc52d6e137721 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Thu, 30 Jan 2025 08:47:45 +0000 Subject: [PATCH] WIP --- .github/workflows/tests.yml | 61 +------------------ tests/ansible/regression/all.yml | 21 ------- ...2__fully_qualified_names_become_method.yml | 58 +++++++++++++++--- 3 files changed, 51 insertions(+), 89 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9a275a00c..df6c5a7d4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: - docs-master env: - #ANSIBLE_VERBOSITY: 3 + ANSIBLE_VERBOSITY: 3 #MITOGEN_LOG_LEVEL: DEBUG MITOGEN_TEST_IMAGE_TEMPLATE: "ghcr.io/mitogen-hq/%(distro)s-test" @@ -26,59 +26,6 @@ jobs: include: - name: Ans_27_210 tox_env: py27-mode_ansible-ansible2.10 - - name: Ans_27_4 - tox_env: py27-mode_ansible-ansible4 - - - name: Ans_36_210 - python_version: '3.6' - tox_env: py36-mode_ansible-ansible2.10 - - name: Ans_36_4 - python_version: '3.6' - tox_env: py36-mode_ansible-ansible4 - - - name: Ans_311_210 - python_version: '3.11' - tox_env: py311-mode_ansible-ansible2.10 - - name: Ans_311_3 - python_version: '3.11' - tox_env: py311-mode_ansible-ansible3 - - name: Ans_311_4 - python_version: '3.11' - tox_env: py311-mode_ansible-ansible4 - - name: Ans_311_5 - python_version: '3.11' - tox_env: py311-mode_ansible-ansible5 - - name: Ans_313_6 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible6 - - name: Ans_313_7 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible7 - - name: Ans_313_8 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible8 - - name: Ans_313_9 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible9 - - name: Ans_313_10 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible10 - - name: Ans_313_11 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible11 - - - name: Van_313_11 - python_version: '3.13' - tox_env: py313-mode_ansible-ansible11-strategy_linear - - - name: Mito_27 - tox_env: py27-mode_mitogen - - name: Mito_36 - python_version: '3.6' - tox_env: py36-mode_mitogen - - name: Mito_313 - python_version: '3.13' - tox_env: py313-mode_mitogen steps: - uses: actions/checkout@v4 @@ -171,12 +118,6 @@ jobs: - name: Mito_313 tox_env: py313-mode_mitogen - - name: Loc_313_11 - tox_env: py313-mode_localhost-ansible11 - - - name: Van_313_11 - tox_env: py313-mode_localhost-ansible11-strategy_linear - steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/tests/ansible/regression/all.yml b/tests/ansible/regression/all.yml index c14225a0a..f68235689 100644 --- a/tests/ansible/regression/all.yml +++ b/tests/ansible/regression/all.yml @@ -1,22 +1 @@ -- import_playbook: issue_109__target_has_old_ansible_installed.yml -- import_playbook: issue_113__duplicate_module_imports.yml -- import_playbook: issue_118__script_not_marked_exec.yml -- import_playbook: issue_122__environment_difference.yml -- import_playbook: issue_140__thread_pileup.yml -- import_playbook: issue_152__local_action_wrong_interpreter.yml -- import_playbook: issue_152__virtualenv_python_fails.yml -- import_playbook: issue_154__module_state_leaks.yml -- import_playbook: issue_177__copy_module_failing.yml -- import_playbook: issue_332_ansiblemoduleerror_first_occurrence.yml -- import_playbook: issue_558_unarchive_failed.yml -- import_playbook: issue_590__sys_modules_crap.yml -- import_playbook: issue_591__setuptools_cwd_crash.yml -- import_playbook: issue_615__streaming_transfer.yml -- import_playbook: issue_655__wait_for_connection_error.yml -- import_playbook: issue_766__get_with_context.yml -- import_playbook: issue_776__load_plugins_called_twice.yml -- import_playbook: issue_952__ask_become_pass.yml -- 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 index 390084ce4..51c7348a2 100644 --- a/tests/ansible/regression/issue_1232__fully_qualified_names_become_method.yml +++ b/tests/ansible/regression/issue_1232__fully_qualified_names_become_method.yml @@ -2,22 +2,64 @@ 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 + - name: Test FQCN sudo, passwordless become: true become_user: root + command: + cmd: whoami + register: fqcn_sudo_passwordless_whoami + changed_when: false + + - assert: + that: + - fqcn_sudo_passwordless_whoami.stdout == 'root' + fail_msg: | + fqcn_sudo_passwordless_whoami={{ fqcn_sudo_passwordless_whoami }} + + - name: Test FQCN sudo, password required + become: true + become_user: mitogen__pw_required + vars: + ansible_become_pass: pw_required_password + command: + cmd: whoami + register: fqcn_sudo_password_whoami + changed_when: false + when: + - become_unpriv_available + + - assert: + that: + - fqcn_sudo_password_whoami.stdout == 'mitogen__pw_required' + fail_msg: | + fqcn_sudo_password_whoami={{ fqcn_sudo_password_whoami }} + when: + - become_unpriv_available + tags: + - sudo - 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 + - name: Test FQCN su, password required + become: true + become_user: mitogen__user1 vars: ansible_become_pass: user1_password + command: + cmd: whoami + register: fqcn_su_password_whoami + changed_when: false when: - become_unpriv_available - ansible.builtin.command: whoami - become: true - become_user: mitogen__user1 + + - assert: + that: + - fqcn_su_password_whoami.stdout == 'mitogen__user1' + fail_msg: | + fqcn_su_password_whoami={{ fqcn_su_password_whoami }} + when: + - become_unpriv_available + tags: + - su