mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
Fix appliance_install: add version parameter
This commit is contained in:
parent
2e75c9319b
commit
ead9747e1b
@ -1284,6 +1284,7 @@ async def appliance_get(
|
||||
@mcp.tool()
|
||||
async def appliance_install(
|
||||
appliance_id: Annotated[str, Field(description="UUID of the appliance to install")],
|
||||
version: Annotated[str | None, Field(description="Version to install (e.g. '2.7.0.356'). Required if the appliance has multiple versions. Use appliance_get to see available versions.")] = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Create a template from a GNS3 appliance definition.
|
||||
|
||||
@ -1294,6 +1295,7 @@ async def appliance_install(
|
||||
"""
|
||||
return await asyncio.to_thread(_run_handler_sync, install_appliance_handler, {
|
||||
"appliance_id": appliance_id,
|
||||
"version": version,
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -80,5 +80,10 @@ def install_appliance_handler(params: dict[str, Any], gns3_ctx: dict[str, Any])
|
||||
if not appliance_id:
|
||||
return {"error": "appliance_id is required"}
|
||||
conn = _get_connector(gns3_ctx)
|
||||
result = conn.http_call("post", f"{conn.base_url}/appliances/{appliance_id}/install").json()
|
||||
url = f"{conn.base_url}/appliances/{appliance_id}/install"
|
||||
request_params = {}
|
||||
version = params.get("version")
|
||||
if version:
|
||||
request_params["version"] = version
|
||||
result = conn.http_call("post", url, params=request_params).json()
|
||||
return {"message": f"Appliance {appliance_id} installation requested", "result": result}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user