This commit is contained in:
eric
2026-03-28 14:16:42 -05:00
parent 8053c4cb6d
commit 92ecc14e43
11 changed files with 325 additions and 45 deletions

View File

@@ -377,10 +377,10 @@ async def service_action(service_id: str, action: str) -> dict:
if not SERVICE_CTL.is_file():
return _default_service_status(spec, "Service controller script is missing")
command = ["bash", str(SERVICE_CTL), service_id, action]
if shutil.which("sudo"):
command = ["sudo", "-n", "bash", str(SERVICE_CTL), service_id, action]
code, output = await _run_command(command, timeout=45.0)
cmd = ["bash", str(SERVICE_CTL), service_id, action]
code, output = await _run_command(cmd, timeout=45.0)
if code != 0 and shutil.which("sudo"):
code, output = await _run_command(["sudo", "-n", *cmd], timeout=45.0)
info = _parse_kv_output(output)
message = info.get("message", output)
if code != 0: