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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user