diff options
author | Thomas Duval <thomas.duval@orange.com> | 2017-10-29 21:07:09 +0100 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2017-10-29 21:07:09 +0100 |
commit | 71eec0f65e954775498f3fd7c0069540a5638a95 (patch) | |
tree | 6343dfd5304bae1f3bd54596c929c9235deb6c7b /moonv4 | |
parent | 068c08a37302b05ee3efac87f14106ca25768f03 (diff) |
Fix some bugs
Change-Id: I15e25e4771122e7145dfc7cbb9cbe39edada5214
Diffstat (limited to 'moonv4')
-rw-r--r-- | moonv4/moon_wrapper/Dockerfile | 1 | ||||
-rw-r--r-- | moonv4/moon_wrapper/moon_wrapper/api/generic.py | 30 | ||||
-rw-r--r-- | moonv4/moon_wrapper/moon_wrapper/api/wrapper.py | 9 | ||||
-rw-r--r-- | moonv4/moon_wrapper/moon_wrapper/http_server.py | 4 | ||||
-rw-r--r-- | moonv4/moon_wrapper/requirements.txt | 2 |
5 files changed, 15 insertions, 31 deletions
diff --git a/moonv4/moon_wrapper/Dockerfile b/moonv4/moon_wrapper/Dockerfile index 2f55c8da..dc06f8df 100644 --- a/moonv4/moon_wrapper/Dockerfile +++ b/moonv4/moon_wrapper/Dockerfile @@ -6,6 +6,7 @@ RUN pip3 install pip --upgrade ADD . /root WORKDIR /root/ RUN pip3 install -r requirements.txt --upgrade +RUN pip3 install /root/dist/* --ugrade RUN pip3 install . CMD ["python3", "-m", "moon_wrapper"] diff --git a/moonv4/moon_wrapper/moon_wrapper/api/generic.py b/moonv4/moon_wrapper/moon_wrapper/api/generic.py index 80e8abff..68687ddb 100644 --- a/moonv4/moon_wrapper/moon_wrapper/api/generic.py +++ b/moonv4/moon_wrapper/moon_wrapper/api/generic.py @@ -8,13 +8,12 @@ Those API are helping API used to manage the Moon platform. from flask_restful import Resource, request from oslo_log import log as logging -from moon_utilities.security_functions import call -import moon_interface.api +import moon_wrapper.api from moon_utilities.security_functions import check_auth __version__ = "0.1.0" -LOG = logging.getLogger("moon.interface.api." + __name__) +LOG = logging.getLogger("moon.manager.api." + __name__) class Status(Resource): @@ -36,7 +35,7 @@ class Status(Resource): } } """ - return call("security_router", method="get_status", ctx={"component_id": component_id}) + raise NotImplemented class Logs(Resource): @@ -71,7 +70,7 @@ class Logs(Resource): args["to"] = to_str args["event_number"] = event_number - return call("security_router", method="get_logs", ctx={"component_id": component_id}, args=args) + raise NotImplemented class API(Resource): @@ -104,7 +103,7 @@ class API(Resource): } """ __methods = ("get", "post", "put", "delete", "options", "patch") - api_list = filter(lambda x: "__" not in x, dir(moon_interface.api)) + api_list = filter(lambda x: "__" not in x, dir(moon_wrapper.api)) api_desc = dict() for api_name in api_list: api_desc[api_name] = {} @@ -130,22 +129,3 @@ class API(Resource): return {"error": "Unknown endpoint_id {}".format(endpoint_id)} return {group_id: api_desc[group_id]} return api_desc - - -class InternalAPI(Resource): - """ - Endpoint for status requests - """ - - __urls__ = ("/internal_api", "/internal_api/", "/internal_api/<string:component_id>") - - def get(self, component_id=None, user_id=""): - api_list = ("orchestrator", "security_router") - if not component_id: - return {"api": api_list} - if component_id in api_list: - api_desc = dict() - api_desc["name"] = component_id - api_desc["endpoints"] = call("security_router", component_id, {}, "list_api") - return api_desc - diff --git a/moonv4/moon_wrapper/moon_wrapper/api/wrapper.py b/moonv4/moon_wrapper/moon_wrapper/api/wrapper.py index 832909c5..1de9278a 100644 --- a/moonv4/moon_wrapper/moon_wrapper/api/wrapper.py +++ b/moonv4/moon_wrapper/moon_wrapper/api/wrapper.py @@ -15,9 +15,9 @@ import requests import time from uuid import uuid4 -from moon_interface.api.authz import pdp_in_cache, pdp_in_manager, container_exist, \ - create_containers, create_authz_request -from moon_interface.authz_requests import AuthzRequest +# from moon_interface.api.authz import pdp_in_cache, pdp_in_manager, container_exist, \ +# create_containers, create_authz_request +# from moon_interface.authz_requests import AuthzRequest from moon_utilities import configuration __version__ = "0.1.0" @@ -31,7 +31,8 @@ class Wrapper(Resource): """ __urls__ = ( - "/", + "/authz", + "/authz/", ) def __init__(self, **kwargs): diff --git a/moonv4/moon_wrapper/moon_wrapper/http_server.py b/moonv4/moon_wrapper/moon_wrapper/http_server.py index d93d6966..39951089 100644 --- a/moonv4/moon_wrapper/moon_wrapper/http_server.py +++ b/moonv4/moon_wrapper/moon_wrapper/http_server.py @@ -100,8 +100,8 @@ class HTTPServer(Server): conf = configuration.get_configuration("components/orchestrator") _hostname = conf["components/orchestrator"].get("hostname", "orchestrator") - _port = conf["components/manager"].get("port", 80) - _protocol = conf["components/manager"].get("protocol", "http") + _port = conf["components/orchestrator"].get("port", 80) + _protocol = conf["components/orchestrator"].get("protocol", "http") self.orchestrator_url = "{}://{}:{}".format( _protocol, _hostname, _port) # Todo : specify only few urls instead of * diff --git a/moonv4/moon_wrapper/requirements.txt b/moonv4/moon_wrapper/requirements.txt index 399ee15b..85ec611f 100644 --- a/moonv4/moon_wrapper/requirements.txt +++ b/moonv4/moon_wrapper/requirements.txt @@ -1,3 +1,5 @@ flask flask_restful +flask_cors +werkzeug moon_utilities
\ No newline at end of file |