1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-25 01:38:08 +00:00

Allow controller to be reloaded using the API. Fixes #1743

This commit is contained in:
grossmj 2021-06-04 17:01:07 +09:30
parent 8be015cd86
commit f64b5cd9b6
2 changed files with 15 additions and 2 deletions

View File

@ -67,6 +67,19 @@ def check_version(version: schemas.Version) -> dict:
return {"version": __version__} return {"version": __version__}
@router.post(
"/reload",
dependencies=[Depends(get_current_active_user)],
status_code=status.HTTP_204_NO_CONTENT,
)
async def reload() -> None:
"""
Reload the controller
"""
await Controller.instance().reload()
@router.post( @router.post(
"/shutdown", "/shutdown",
dependencies=[Depends(get_current_active_user)], dependencies=[Depends(get_current_active_user)],
@ -75,7 +88,7 @@ def check_version(version: schemas.Version) -> dict:
) )
async def shutdown() -> None: async def shutdown() -> None:
""" """
Shutdown the local server Shutdown the server
""" """
if Config.instance().settings.Server.local is False: if Config.instance().settings.Server.local is False:

View File

@ -1,4 +1,4 @@
uvicorn==0.13.4 uvicorn==0.14.0
fastapi==0.65.1 fastapi==0.65.1
websockets==9.1 websockets==9.1
python-multipart==0.0.5 python-multipart==0.0.5