GRM-17: fix: make grm list retrieve runner status correctly

- run_ad_hoc() now raises AnsibleError on non-zero exit, surfacing
  stderr instead of silently returning empty stdout
- list_runners() passes become=True to run_ad_hoc since systemctl
  is-active requires root privileges
- Add i18n translations for ad-hoc failure messages
- Add unit test for run_ad_hoc failure case
- Update list_runners test to expect become=True
- 119 tests, 100% coverage, pyright clean, ruff clean
This commit is contained in:
Emil Simeonov
2026-06-19 02:05:06 +02:00
parent 677745ac99
commit 18760f6a2a
5 changed files with 38 additions and 2 deletions
+9
View File
@@ -109,6 +109,15 @@ class AnsibleExecutor:
capture_output=True,
text=True,
)
if proc.returncode != 0:
stderr = proc.stderr.strip() if proc.stderr else ""
raise AnsibleError(
_(
"Ad-hoc command failed on {host}: {stderr}",
host=host,
stderr=stderr or _("exit code {code}", code=proc.returncode),
)
)
return proc.stdout.strip()
def _extract_status(self, log_file: Path) -> str | None: