aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/templates
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2017-11-03 15:07:12 +0100
committerThomas Duval <thomas.duval@orange.com>2017-11-03 15:07:12 +0100
commitfa11d78e728029bcefa0ad6608d422715ae8f0be (patch)
tree99aa1b2e44b6008b34d4d8e01c6af56eca6ca773 /moonv4/templates
parent0418b00f6d811c7b407bd8abbe80064605e37c06 (diff)
Fix the Moon platform startup and fix some bugs in startup.
Change-Id: I9014071c755ec5ef0c9eb0d575af29d5f3ad3533
Diffstat (limited to 'moonv4/templates')
-rw-r--r--moonv4/templates/moonforming/run.sh20
-rw-r--r--moonv4/templates/moonforming/utils/pdp.py6
2 files changed, 22 insertions, 4 deletions
diff --git a/moonv4/templates/moonforming/run.sh b/moonv4/templates/moonforming/run.sh
index 25e015fb..e3c052c5 100644
--- a/moonv4/templates/moonforming/run.sh
+++ b/moonv4/templates/moonforming/run.sh
@@ -1,12 +1,26 @@
#!/usr/bin/env bash
-# TODO: wait for consul
+echo "Waiting for Consul (http://consul:8500)"
+while ! python -c "import requests; req = requests.get('http://consul:8500')" 2>/dev/null ; do
+ sleep 5 ;
+ echo "."
+done
+
+echo "Manager (http://consul:8500) is up."
+
python3 /root/conf2consul.py /etc/moon/moon.conf
-# TODO: wait for database
+echo "Waiting for DB (tcp://db:3306)"
+while ! python -c "import socket, sys; s = socket.socket(socket.AF_INET, socket.SOCK_STREAM); s.connect(('db', 3306)); sys.exit(0)" 2>/dev/null ; do
+ sleep 5 ;
+ echo "."
+done
+
+echo "Manager (http://db:3306) is up."
+
moon_db_manager upgrade
-echo "Waiting for manager (http://manager:8082)"
+echo "Waiting for Manager (http://manager:8082)"
while ! python -c "import requests; req = requests.get('http://manager:8082')" 2>/dev/null ; do
sleep 5 ;
echo "."
diff --git a/moonv4/templates/moonforming/utils/pdp.py b/moonv4/templates/moonforming/utils/pdp.py
index 4f513aa6..676b216b 100644
--- a/moonv4/templates/moonforming/utils/pdp.py
+++ b/moonv4/templates/moonforming/utils/pdp.py
@@ -15,7 +15,7 @@ KEYSTONE_SERVER = config['openstack']['keystone']['url']
pdp_template = {
"name": "test_pdp",
"security_pipeline": [],
- "keystone_project_id": "",
+ "keystone_project_id": None,
"description": "test",
}
@@ -46,6 +46,8 @@ def get_keystone_projects():
}
req = requests.post("{}/auth/tokens".format(KEYSTONE_SERVER), json=data_auth, headers=HEADERS)
+ print("{}/auth/tokens".format(KEYSTONE_SERVER))
+ print(req.text)
assert req.status_code in (200, 201)
TOKEN = req.headers['X-Subject-Token']
HEADERS['X-Auth-Token'] = TOKEN
@@ -95,6 +97,8 @@ def add_pdp(name="test_pdp", policy_id=None):
if policy_id:
pdp_template['security_pipeline'].append(policy_id)
req = requests.post(URL + "/pdp", json=pdp_template, headers=HEADERS)
+ print(req.status_code)
+ print(req)
assert req.status_code == 200
result = req.json()
assert type(result) is dict