From 1a24ebfc196cb77fd752e3338d151354a75f9294 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 1 Aug 2021 16:20:30 +0930 Subject: [PATCH] Add a `reload` server endpoint. Fixes #1926 --- .../handlers/api/controller/server_handler.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gns3server/handlers/api/controller/server_handler.py b/gns3server/handlers/api/controller/server_handler.py index 915faa39..d4b6f6d4 100644 --- a/gns3server/handlers/api/controller/server_handler.py +++ b/gns3server/handlers/api/controller/server_handler.py @@ -78,6 +78,22 @@ class ServerHandler: pass response.set_status(201) + @classmethod + @Route.post( + r"/reload", + description="Reload the local server", + status_codes={ + 200: "Server has reloaded" + }) + async def reload(request, response): + + from gns3server.web.web_server import WebServer + server = WebServer.instance() + try: + asyncio.ensure_future(server.reload_server()) + except asyncio.CancelledError: + pass + @Route.get( r"/version", description="Retrieve the server version number",