From 610ef70bad3de6b83c4ca09013c26e91ef6578e6 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Fri, 30 Jun 2023 00:32:52 -0400 Subject: [PATCH] allnet: add Alive get and post handlers --- core/allnet.py | 3 +++ index.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/core/allnet.py b/core/allnet.py index 00303f5..edb704c 100644 --- a/core/allnet.py +++ b/core/allnet.py @@ -256,6 +256,9 @@ class AllnetServlet: self.logger.info(f"LoaderStateRecorder Request from {ip} {serial}: {num_files_dld}/{num_files_to_dl} Files download (State: {dl_state})") return "OK".encode() + + def handle_alive(self, request: Request, match: Dict) -> bytes: + return "OK".encode() def handle_billing_request(self, request: Request, _: Dict): req_dict = self.billing_req_to_dict(request.content.getvalue()) diff --git a/index.py b/index.py index 265bded..6996f0e 100644 --- a/index.py +++ b/index.py @@ -70,6 +70,20 @@ class HttpDispatcher(resource.Resource): action="handle_loaderstaterecorder", conditions=dict(method=["POST"]), ) + self.map_post.connect( + "allnet_alive", + "/sys/servlet/Alive", + controller="allnet", + action="handle_alive", + conditions=dict(method=["POST"]), + ) + self.map_get.connect( + "allnet_alive", + "/sys/servlet/Alive", + controller="allnet", + action="handle_alive", + conditions=dict(method=["GET"]), + ) self.map_post.connect( "allnet_billing", "/request",