Remove pull_image + list_registries; mark Gruppen 6+7 as entfällt
DSM methods for SYNO.Docker.Image/pull and SYNO.Docker.Registry/get did not behave as expected in production testing against the NAS. Tools deregistered, modules deleted, tests removed, CLAUDE.md updated. Tool count: 19 → 17. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
"""MCP tools for SYNO.Docker.Image: list, check updates, delete, pull."""
|
||||
"""MCP tools for SYNO.Docker.Image: list, check updates, delete."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
@@ -270,56 +269,6 @@ def register_images(mcp: FastMCP, config: AppConfig, client: DsmClient) -> None:
|
||||
|
||||
return f"Deleted {display_name} — {size_str} freed."
|
||||
|
||||
@mcp.tool()
|
||||
async def pull_image(image: str) -> str:
|
||||
"""Pull a Docker image from the active registry.
|
||||
|
||||
Splits the image reference into repository and tag, triggers the pull
|
||||
via DSM, then polls the image list until the image appears (up to 120 s).
|
||||
|
||||
Args:
|
||||
image: Image reference as "name:tag" (e.g. "postgres:17.8").
|
||||
Tag defaults to "latest" when omitted.
|
||||
"""
|
||||
repository, sep, tag = image.rpartition(":")
|
||||
if not sep:
|
||||
repository = image
|
||||
tag = "latest"
|
||||
|
||||
try:
|
||||
await client.request(
|
||||
"SYNO.Docker.Image",
|
||||
"pull",
|
||||
params={"repository": repository, "tag": tag},
|
||||
)
|
||||
except Exception as e:
|
||||
return f"Error starting pull of '{image}': {e}"
|
||||
|
||||
# DSM starts the pull asynchronously; poll until the image appears.
|
||||
deadline = 120
|
||||
interval = 3
|
||||
elapsed = 0
|
||||
while elapsed < deadline:
|
||||
await asyncio.sleep(interval)
|
||||
elapsed += interval
|
||||
try:
|
||||
img_data = await client.request(
|
||||
"SYNO.Docker.Image",
|
||||
"list",
|
||||
params={"limit": "-1", "offset": "0", "show_dsm": "false"},
|
||||
)
|
||||
except Exception:
|
||||
continue
|
||||
for img in img_data.get("images", []):
|
||||
if img.get("repository") == repository and tag in (img.get("tags") or []):
|
||||
size_str = _human_size(img.get("size", 0))
|
||||
return f"Pulled {repository}:{tag} — {size_str}."
|
||||
|
||||
return (
|
||||
f"Pull of '{repository}:{tag}' started but did not complete within "
|
||||
f"{deadline} s. Check DSM Container Manager for status."
|
||||
)
|
||||
|
||||
@mcp.tool()
|
||||
async def check_image_updates(project_name: str | None = None) -> str:
|
||||
"""Check for available image updates for a project or all images.
|
||||
|
||||
Reference in New Issue
Block a user