GRM-111: feat: unified --become-password-file, --verbose, --no-status, labels fix
Post-merge / detect-type (push) Successful in 51s
Post-merge / release (push) Successful in 1m14s
Post-merge / validate-commit-msg (push) Successful in 1m14s
Post-merge / vikunja (push) Successful in 1m14s
Post-merge / badges (push) Successful in 1m25s
Post-merge / sync-wiki (push) Successful in 1m53s
Post-merge / configure-repo (push) Successful in 1m20s
Post-merge / publish (push) Successful in 1m21s

This commit was merged in pull request #178.
This commit is contained in:
2026-06-28 11:21:11 +00:00
parent 763f7640af
commit f67dff8458
16 changed files with 865 additions and 73 deletions
+27
View File
@@ -260,6 +260,33 @@ class TestAnsibleExecutorAdHoc:
assert "--become" not in cmd
assert "--ask-become-pass" not in cmd
def test_run_ad_hoc_with_env_become_password_file(self, tmp_path: Path) -> None:
"""ANSIBLE_BECOME_PASSWORD_FILE env var used when become_pass is None."""
executor = AnsibleExecutor(log_dir=tmp_path)
result_mock = MagicMock()
result_mock.stdout = "ok\n"
result_mock.returncode = 0
result_mock.stderr = ""
with patch.dict("os.environ", {"ANSIBLE_BECOME_PASSWORD_FILE": "/tmp/env-pw.txt"}):
with patch("subprocess.run", return_value=result_mock) as mock_run:
result = executor.run_ad_hoc(
"10.0.0.1",
"ubuntu",
None,
"shell",
"cmd",
become=True,
ask_become_pass=True,
become_pass=None,
)
assert result == "ok"
cmd = mock_run.call_args.args[0]
assert "--become-password-file" in cmd
assert "/tmp/env-pw.txt" in cmd
assert "--ask-become-pass" not in cmd
def test_run_ad_hoc_check_false(self, tmp_path: Path) -> None:
executor = AnsibleExecutor(log_dir=tmp_path)
result_mock = MagicMock()