From 551bab5fe665fb5aadb0cf919db1ce3111a620ec Mon Sep 17 00:00:00 2001 From: ogt Date: Sun, 19 Apr 2026 16:32:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(ai-ops):=20=E7=A7=BB=E9=99=A4=20DOCKER=5FRE?= =?UTF-8?q?START=20compose=3DTrue=20=E9=87=8D=E8=A4=87=E5=91=BC=E5=8F=AB?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原本邏輯:先呼叫 docker compose restart(白名單通過) 再馬上覆寫 ok/output 用 docker restart(多餘且不一致)。 compose 選項已無意義,統一用 docker restart(SSH 白名單允許)。 Co-Authored-By: Claude Sonnet 4.6 --- services/auto_heal_service.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/services/auto_heal_service.py b/services/auto_heal_service.py index 9f78eff..cc0af67 100644 --- a/services/auto_heal_service.py +++ b/services/auto_heal_service.py @@ -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