mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-25 01:38:08 +00:00
Fix websocket compute notifications after upgrade to FastAPI 0.97.0
This commit is contained in:
parent
d366d77ff7
commit
4b791d4924
@ -58,7 +58,6 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
compute_api = FastAPI(
|
compute_api = FastAPI(
|
||||||
title="GNS3 compute API",
|
title="GNS3 compute API",
|
||||||
dependencies=[Depends(compute_authentication)],
|
|
||||||
description="This page describes the private compute API for GNS3. PLEASE DO NOT USE DIRECTLY!",
|
description="This page describes the private compute API for GNS3. PLEASE DO NOT USE DIRECTLY!",
|
||||||
version="v3",
|
version="v3",
|
||||||
)
|
)
|
||||||
@ -158,11 +157,13 @@ async def http_exception_handler(request: Request, exc: StarletteHTTPException):
|
|||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
capabilities.router,
|
capabilities.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
tags=["Capabilities"]
|
tags=["Capabilities"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
compute.router,
|
compute.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
tags=["Compute"]
|
tags=["Compute"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -173,86 +174,101 @@ compute_api.include_router(
|
|||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
projects.router,
|
projects.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
tags=["Projects"]
|
tags=["Projects"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
images.router,
|
images.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
tags=["Images"]
|
tags=["Images"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
atm_switch_nodes.router,
|
atm_switch_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/atm_switch/nodes",
|
prefix="/projects/{project_id}/atm_switch/nodes",
|
||||||
tags=["ATM switch"]
|
tags=["ATM switch"]
|
||||||
)
|
)
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
cloud_nodes.router,
|
cloud_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/cloud/nodes",
|
prefix="/projects/{project_id}/cloud/nodes",
|
||||||
tags=["Cloud nodes"]
|
tags=["Cloud nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
docker_nodes.router,
|
docker_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/docker/nodes",
|
prefix="/projects/{project_id}/docker/nodes",
|
||||||
tags=["Docker nodes"]
|
tags=["Docker nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
dynamips_nodes.router,
|
dynamips_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/dynamips/nodes",
|
prefix="/projects/{project_id}/dynamips/nodes",
|
||||||
tags=["Dynamips nodes"]
|
tags=["Dynamips nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
ethernet_hub_nodes.router,
|
ethernet_hub_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/ethernet_hub/nodes",
|
prefix="/projects/{project_id}/ethernet_hub/nodes",
|
||||||
tags=["Ethernet hub nodes"]
|
tags=["Ethernet hub nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
ethernet_switch_nodes.router,
|
ethernet_switch_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/ethernet_switch/nodes",
|
prefix="/projects/{project_id}/ethernet_switch/nodes",
|
||||||
tags=["Ethernet switch nodes"]
|
tags=["Ethernet switch nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
frame_relay_switch_nodes.router,
|
frame_relay_switch_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/frame_relay_switch/nodes",
|
prefix="/projects/{project_id}/frame_relay_switch/nodes",
|
||||||
tags=["Frame Relay switch nodes"]
|
tags=["Frame Relay switch nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
iou_nodes.router,
|
iou_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/iou/nodes",
|
prefix="/projects/{project_id}/iou/nodes",
|
||||||
tags=["IOU nodes"])
|
tags=["IOU nodes"])
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
nat_nodes.router,
|
nat_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/nat/nodes",
|
prefix="/projects/{project_id}/nat/nodes",
|
||||||
tags=["NAT nodes"]
|
tags=["NAT nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
qemu_nodes.router,
|
qemu_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/qemu/nodes",
|
prefix="/projects/{project_id}/qemu/nodes",
|
||||||
tags=["Qemu nodes"]
|
tags=["Qemu nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
virtualbox_nodes.router,
|
virtualbox_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/virtualbox/nodes",
|
prefix="/projects/{project_id}/virtualbox/nodes",
|
||||||
tags=["VirtualBox nodes"]
|
tags=["VirtualBox nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
vmware_nodes.router,
|
vmware_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/vmware/nodes",
|
prefix="/projects/{project_id}/vmware/nodes",
|
||||||
tags=["VMware nodes"]
|
tags=["VMware nodes"]
|
||||||
)
|
)
|
||||||
|
|
||||||
compute_api.include_router(
|
compute_api.include_router(
|
||||||
vpcs_nodes.router,
|
vpcs_nodes.router,
|
||||||
|
dependencies=[Depends(compute_authentication)],
|
||||||
prefix="/projects/{project_id}/vpcs/nodes",
|
prefix="/projects/{project_id}/vpcs/nodes",
|
||||||
tags=["VPCS nodes"]
|
tags=["VPCS nodes"]
|
||||||
)
|
)
|
||||||
|
@ -35,7 +35,7 @@ router = APIRouter()
|
|||||||
|
|
||||||
|
|
||||||
@router.websocket("/notifications/ws")
|
@router.websocket("/notifications/ws")
|
||||||
async def notification_ws(websocket: WebSocket) -> None:
|
async def project_ws_notifications(websocket: WebSocket) -> None:
|
||||||
"""
|
"""
|
||||||
Receive project notifications about the project from WebSocket.
|
Receive project notifications about the project from WebSocket.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user