diff options
Diffstat (limited to 'moon_orchestrator/moon_orchestrator')
5 files changed, 14 insertions, 8 deletions
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("@", "-") - |