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:
YueGuobin committed 2026-08-25 21:29:53 +08:00
1 parent 97e7a79117
commit c9bc635996
2 files changed
+40 -7

No files matched your search

+4 -5
View File
@@ -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(