From 2e35a7e46f0929438c1c206e3116caa829f07dc6 Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Fri, 5 Oct 2018 16:54:37 +0200 Subject: Update code to 4.6 official version Change-Id: Ibd0da0e476e24b2685f54693efc11f7a58d40a62 --- moon_wrapper/moon_wrapper/http_server.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'moon_wrapper/moon_wrapper/http_server.py') diff --git a/moon_wrapper/moon_wrapper/http_server.py b/moon_wrapper/moon_wrapper/http_server.py index dfbaed9f..015bb285 100644 --- a/moon_wrapper/moon_wrapper/http_server.py +++ b/moon_wrapper/moon_wrapper/http_server.py @@ -10,17 +10,17 @@ import logging from moon_wrapper import __version__ from moon_wrapper.api.generic import Status, Logs, API from moon_wrapper.api.oslowrapper import OsloWrapper +from moon_wrapper.api.slaveupdate import SlaveUpdate from python_moonutilities.cache import Cache from python_moonutilities import configuration, exceptions -logger = logging.getLogger("moon.wrapper.http_server") - +LOGGER = logging.getLogger("moon.wrapper.http_server") CACHE = Cache() __API__ = ( Status, Logs, API - ) +) class Server: @@ -71,7 +71,7 @@ class Root(Resource): """ The root of the web service """ - __urls__ = ("/", ) + __urls__ = ("/",) __methods = ("get", "post", "put", "delete", "options") def get(self): @@ -111,7 +111,6 @@ class HTTPServer(Server): self.__hook_errors() def __hook_errors(self): - def get_404_json(e): return flask.make_response("False") @@ -134,7 +133,12 @@ class HTTPServer(Server): "cache": CACHE, } ) + self.api.add_resource(SlaveUpdate, *SlaveUpdate.__urls__, + resource_class_kwargs={ + "orchestrator_url": self.orchestrator_url, + "cache": CACHE, + } + ) def run(self): self.app.run(host=self._host, port=self._port, threaded=True) # nosec - -- cgit 1.2.3-korg