fix(ai-ops): 移除 DOCKER_RESTART compose=True 重複呼叫 bug
All checks were successful
CD Pipeline / deploy (push) Successful in 1m22s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m22s
原本邏輯:先呼叫 docker compose restart(白名單通過) 再馬上覆寫 ok/output 用 docker restart(多餘且不一致)。 compose 選項已無意義,統一用 docker restart(SSH 白名單允許)。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -306,16 +306,9 @@ class AutoHealService:
|
||||
try:
|
||||
if playbook.action_type == "DOCKER_RESTART":
|
||||
container = params.get("container", "")
|
||||
use_compose = params.get("compose", False)
|
||||
if use_compose:
|
||||
cmd = f"cd /home/ollama/momo-pro && docker compose restart {container}"
|
||||
else:
|
||||
cmd = f"docker restart {container}"
|
||||
cmd = f"docker restart {container}"
|
||||
action_detail = cmd
|
||||
ok, output = _execute_ssh_cmd(cmd if not use_compose else f"docker compose restart {container}")
|
||||
# compose 指令需要在目錄下執行,強制用 SSH
|
||||
if use_compose:
|
||||
ok, output = _execute_ssh_cmd(f"docker restart {container}")
|
||||
ok, output = _execute_ssh_cmd(cmd)
|
||||
result = "success" if ok else "failed"
|
||||
result_output = output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user