s'
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user