diff options
author | Thomas Duval <thomas.duval@orange.com> | 2017-11-06 14:02:18 +0100 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2017-11-06 14:06:10 +0100 |
commit | 9519d179cda8734fa0890d136c4bd2019bb7ddc4 (patch) | |
tree | 48b0c8b882f574e0f93ae5e087878e2700e40c0d /moonv4/moon_manager | |
parent | b372140e577ca5d850875139fde6e36ae0e868d4 (diff) |
Fix the bug on the connection between interface and authz.
Change-Id: Iea2f763fb2cfb90250be76d91cb2fe0e9b481716
Diffstat (limited to 'moonv4/moon_manager')
-rw-r--r-- | moonv4/moon_manager/Dockerfile | 2 | ||||
-rw-r--r-- | moonv4/moon_manager/moon_manager/api/pdp.py | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/moonv4/moon_manager/Dockerfile b/moonv4/moon_manager/Dockerfile index 17bee16a..873e3aa2 100644 --- a/moonv4/moon_manager/Dockerfile +++ b/moonv4/moon_manager/Dockerfile @@ -6,7 +6,7 @@ RUN pip3 install pip --upgrade ADD . /root WORKDIR /root/ RUN pip3 install -r requirements.txt -RUN pip3 install /root/dist/* --upgrade +#RUN pip3 install /root/dist/* --upgrade RUN pip3 install . CMD ["python3", "-m", "moon_manager"]
\ No newline at end of file diff --git a/moonv4/moon_manager/moon_manager/api/pdp.py b/moonv4/moon_manager/moon_manager/api/pdp.py index ffc91fba..465f4dba 100644 --- a/moonv4/moon_manager/moon_manager/api/pdp.py +++ b/moonv4/moon_manager/moon_manager/api/pdp.py @@ -14,6 +14,8 @@ import requests import time from moon_utilities.security_functions import check_auth from moon_db.core import PDPManager +from moon_db.core import PolicyManager +from moon_db.core import ModelManager from moon_utilities import configuration __version__ = "0.1.0" @@ -26,15 +28,23 @@ def delete_pod(uuid): def add_pod(uuid, data): + if not data.get("keystone_project_id"): + return LOG.info("Add a new pod {}".format(data)) + if "pdp_id" not in data: + data["pdp_id"] = uuid + data['policies'] = PolicyManager.get_policies(user_id="admin") + data['models'] = ModelManager.get_models(user_id="admin") conf = configuration.get_configuration("components/orchestrator") hostname = conf["components/orchestrator"].get("hostname", "orchestrator") port = conf["components/orchestrator"].get("port", 80) proto = conf["components/orchestrator"].get("protocol", "http") while True: try: - req = requests.post("{}://{}:{}/pods".format(proto, hostname, port), - data=data) + req = requests.post( + "{}://{}:{}/pods".format(proto, hostname, port), + json=data, + headers={"content-type": "application/json"}) except requests.exceptions.ConnectionError: LOG.warning("Orchestrator is not ready, standby...") time.sleep(1) |