mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
fix: propagate 405 when suspending a node without suspend support
Suspending a single VPCS/IOU node returned a fake 204: the controller route swallowed the compute 405 that the node types honestly raise, so callers saw success while the node stayed started. Surface the 405 instead. The best-effort swallow on suspend_all is kept (and now covered by a test) since mixed projects legitimately contain always-running node types.
This commit is contained in:
2 files changed
+40
-7
No files matched your search
@@ -372,14 +372,13 @@ async def suspend_node(node: Node = Depends(dep_node)) -> None:
|
||||
"""
|
||||
Suspend a node.
|
||||
|
||||
Node types without suspend support return a 405 error instead of a
|
||||
silent no-op, so the caller cannot mistake it for a suspended node.
|
||||
|
||||
Required privilege: Node.PowerMgmt
|
||||
"""
|
||||
|
||||
try:
|
||||
await node.suspend()
|
||||
except HTTPException as e:
|
||||
if not e.status_code == status.HTTP_405_METHOD_NOT_ALLOWED:
|
||||
raise
|
||||
await node.suspend()
|
||||
|
||||
|
||||
@router.post(
|
||||
|
||||
Reference in new issue
Block a user