diff options
author | 2018-10-05 16:54:37 +0200 | |
---|---|---|
committer | 2018-10-05 16:58:48 +0200 | |
commit | 2e35a7e46f0929438c1c206e3116caa829f07dc6 (patch) | |
tree | 759a83b3dfefe70faeada1c3af7377f4cd89b8eb /moon_orchestrator | |
parent | 2dbe655587ca98b67c1a3e3798c63fd47229adc0 (diff) |
Update code to 4.6 official version
Change-Id: Ibd0da0e476e24b2685f54693efc11f7a58d40a62
Diffstat (limited to 'moon_orchestrator')
-rw-r--r-- | moon_orchestrator/Changelog | 7 | ||||
-rw-r--r-- | moon_orchestrator/Dockerfile | 2 | ||||
-rw-r--r-- | moon_orchestrator/moon_orchestrator/__init__.py | 2 | ||||
-rw-r--r-- | moon_orchestrator/moon_orchestrator/api/generic.py | 7 | ||||
-rw-r--r-- | moon_orchestrator/moon_orchestrator/api/pods.py | 4 | ||||
-rw-r--r-- | moon_orchestrator/moon_orchestrator/drivers.py | 2 | ||||
-rw-r--r-- | moon_orchestrator/moon_orchestrator/http_server.py | 7 |
7 files changed, 22 insertions, 9 deletions
diff --git a/moon_orchestrator/Changelog b/moon_orchestrator/Changelog index 783c9130..c04af79c 100644 --- a/moon_orchestrator/Changelog +++ b/moon_orchestrator/Changelog @@ -27,3 +27,10 @@ CHANGES ----- - the processing of a request is now performed in a thread +4.4.2 +----- +- apply pylint rules + +4.4.3 +----- +- add "internal_port" key in slave API diff --git a/moon_orchestrator/Dockerfile b/moon_orchestrator/Dockerfile index 09d12fda..7c59efb5 100644 --- a/moon_orchestrator/Dockerfile +++ b/moon_orchestrator/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3 +FROM python:3.6 LABEL Name=Orchestrator LABEL Description="Orchestrator component for the Moon platform" diff --git a/moon_orchestrator/moon_orchestrator/__init__.py b/moon_orchestrator/moon_orchestrator/__init__.py index bc8f2781..31d40184 100644 --- a/moon_orchestrator/moon_orchestrator/__init__.py +++ b/moon_orchestrator/moon_orchestrator/__init__.py @@ -3,4 +3,4 @@ # license which can be found in the file 'LICENSE' in this package distribution # or at 'http://www.apache.org/licenses/LICENSE-2.0'. -__version__ = "4.4.1" +__version__ = "4.4.3" diff --git a/moon_orchestrator/moon_orchestrator/api/generic.py b/moon_orchestrator/moon_orchestrator/api/generic.py index 37e30a22..9128140a 100644 --- a/moon_orchestrator/moon_orchestrator/api/generic.py +++ b/moon_orchestrator/moon_orchestrator/api/generic.py @@ -77,13 +77,16 @@ class API(Resource): if "__version__" in dir(group_api_obj): api_desc[api_name]["version"] = group_api_obj.__version__ object_list = list(filter(lambda x: "__" not in x, dir(group_api_obj))) - for obj in map(lambda x: eval("moon_interface.api.{}.{}".format(api_name, x)), object_list): + for obj in map(lambda x: eval("moon_interface.api.{}.{}".format(api_name, x)), + object_list): if "__urls__" in dir(obj): api_desc[api_name][obj.__name__] = dict() api_desc[api_name][obj.__name__]["urls"] = obj.__urls__ api_desc[api_name][obj.__name__]["methods"] = dict() for _method in filter(lambda x: x in __methods, dir(obj)): - docstring = eval("moon_interface.api.{}.{}.{}.__doc__".format(api_name, obj.__name__, _method)) + docstring = eval( + "moon_interface.api.{}.{}.{}.__doc__".format(api_name, obj.__name__, + _method)) api_desc[api_name][obj.__name__]["methods"][_method] = docstring api_desc[api_name][obj.__name__]["description"] = str(obj.__doc__) if group_id in api_desc: diff --git a/moon_orchestrator/moon_orchestrator/api/pods.py b/moon_orchestrator/moon_orchestrator/api/pods.py index 389fa5b0..8943e018 100644 --- a/moon_orchestrator/moon_orchestrator/api/pods.py +++ b/moon_orchestrator/moon_orchestrator/api/pods.py @@ -73,7 +73,7 @@ class Pods(Resource): def __get_slave_names(self): for slave in self.driver.get_slaves(): - if "name" in slave : + if "name" in slave: yield slave["name"] @check_auth @@ -146,7 +146,7 @@ class Pods(Resource): if "name" in slave and "wrapper_name" in slave: if uuid in (slave['name'], slave["wrapper_name"]): self.driver.delete_wrapper(name=slave["wrapper_name"]) - else : + else: raise exceptions.SlaveNameUnknown except Exception as e: return {"result": False, "message": str(e)}, 500 diff --git a/moon_orchestrator/moon_orchestrator/drivers.py b/moon_orchestrator/moon_orchestrator/drivers.py index 4519f3aa..233d389e 100644 --- a/moon_orchestrator/moon_orchestrator/drivers.py +++ b/moon_orchestrator/moon_orchestrator/drivers.py @@ -209,6 +209,7 @@ class K8S(Driver): data["wrapper_name"] = value[0]['name'] data["ip"] = value[0].get("ip", "NC") data["port"] = value[0].get("external_port", "NC") + data["internal_port"] = value[0].get("port", "NC") slaves.append(data) break return slaves @@ -223,6 +224,7 @@ class K8S(Driver): data["wrapper_name"] = value[0]['name'] data["ip"] = value[0].get("ip", "NC") data["port"] = value[0].get("external_port", "NC") + data["internal_port"] = value[0].get("port", "NC") data["configured"] = True break slaves.append(data) diff --git a/moon_orchestrator/moon_orchestrator/http_server.py b/moon_orchestrator/moon_orchestrator/http_server.py index 1cb12618..72e12358 100644 --- a/moon_orchestrator/moon_orchestrator/http_server.py +++ b/moon_orchestrator/moon_orchestrator/http_server.py @@ -19,7 +19,7 @@ logger = logging.getLogger("moon.orchestrator.http_server") __API__ = ( Status, - ) +) class Server: @@ -70,7 +70,7 @@ class Root(Resource): """ The root of the web service """ - __urls__ = ("/", ) + __urls__ = ("/",) __methods = ("get", "post", "put", "delete", "options") def get(self): @@ -136,10 +136,12 @@ class HTTPServer(Server): def get_404_json(e): return jsonify({"result": False, "code": 404, "description": str(e)}), 404 + self.app.register_error_handler(404, get_404_json) def get_400_json(e): return jsonify({"result": False, "code": 400, "description": str(e)}), 400 + self.app.register_error_handler(400, lambda e: get_400_json) self.app.register_error_handler(403, exceptions.AuthException) @@ -163,4 +165,3 @@ class HTTPServer(Server): @staticmethod def __filter_str(data): return data.replace("@", "-") - |