feat(infra): docker_restart 쓰기 도구 추가

보호 컨테이너(home-caddy, home-fail2ban, nanoclaude) 재시작 차단.
MCP 11개 도구 + NanoClaude wrapper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-13 15:06:40 +09:00
parent d47c04317c
commit 03e3df058f
4 changed files with 74 additions and 5 deletions
+14 -1
View File
@@ -9,7 +9,7 @@ from __future__ import annotations
import asyncio
import logging
from infra.core.docker import docker_status
from infra.core.docker import docker_status, docker_restart as _docker_restart
from infra.core.health import service_health, VALID_SERVICES
from infra.core.system import disk_usage
from infra.core.network import tailscale_status
@@ -128,3 +128,16 @@ async def queue() -> dict:
async def verify(check_name: str = "gpu-snapshot") -> dict:
"""Run predefined verify command."""
return await _run_verify(check_name)
async def restart(host: str = "gpu", container: str = "") -> dict:
"""Restart a Docker container."""
if not container:
return {"ok": False, "tool": "infra", "operation": "restart",
"data": [], "summary": "", "error": "컨테이너 이름을 지정해주세요."}
result = await _docker_restart(host, container)
ok = result.ok
return {"ok": ok, "tool": "infra", "operation": "restart",
"data": result.warnings if ok else [],
"summary": result.warnings[0] if ok and result.warnings else "",
"error": result.error or ("재시작 실패" if not ok else "")}
+3 -1
View File
@@ -21,7 +21,7 @@ ALLOWED_OPS = {
"calendar": {"today", "search", "create_draft", "create_confirmed"},
"email": {"search", "read"},
"document": {"search", "read"},
"infra": {"status", "health", "disk", "network", "models", "scheduler", "queue", "verify"},
"infra": {"status", "health", "disk", "network", "models", "scheduler", "queue", "verify", "restart"},
}
# payload hard limit
@@ -119,6 +119,8 @@ async def _exec_infra(operation: str, params: dict) -> dict:
return await infra_tool.queue()
elif operation == "verify":
return await infra_tool.verify(params.get("check_name", "gpu-snapshot"))
elif operation == "restart":
return await infra_tool.restart(params.get("host", "gpu"), params.get("container", ""))
return _error("infra", operation, "미구현")