summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShrenik <shrenik.jain@research.iiit.ac.in>2017-05-31 00:38:55 +0530
committerShrenik <shrenik.jain@research.iiit.ac.in>2017-06-05 22:22:41 +0530
commit5596aa1f65580af279b27569fbddac292cbcc2a6 (patch)
tree7eccb0fd3e9e5aec847cfbfd34a8c36e62b32837
parent8f3c6859e483961fd9740bb662bbd049b512bba2 (diff)
Adding CORS
Adds flask-cors module so that SwaggerUI can examine content from a different container JIRA: STORPERF-129 Change-Id: I9c47a2ea464da83910c368d771dce13f5364ca23 Signed-off-by: Shrenik <shrenik.jain@research.iiit.ac.in>
-rwxr-xr-xci/launch_docker_container.sh7
-rwxr-xr-xci/verify.sh1
-rw-r--r--docker/requirements.pip1
-rw-r--r--rest_server.py2
4 files changed, 10 insertions, 1 deletions
diff --git a/ci/launch_docker_container.sh b/ci/launch_docker_container.sh
index b119946..ec9c4d8 100755
--- a/ci/launch_docker_container.sh
+++ b/ci/launch_docker_container.sh
@@ -29,7 +29,12 @@ then
sudo chown 33:33 job/carbon
fi
-docker pull opnfv/storperf:latest
+if [ -z $DOCKER_TAG ]
+then
+ DOCKER_TAG=latest
+fi
+
+docker pull opnfv/storperf:$DOCKER_TAG
docker run -d --env-file `pwd`/job/admin.rc \
-p 5000:5000 \
diff --git a/ci/verify.sh b/ci/verify.sh
index 84dc603..28d0886 100755
--- a/ci/verify.sh
+++ b/ci/verify.sh
@@ -23,6 +23,7 @@ pip install autoflake==0.6.6
pip install autopep8==1.2.2
pip install coverage==4.1
pip install flask==0.10
+pip install flask_cors==3.0.2
pip install flask-restful==0.3.5
pip install flask-restful-swagger==0.19
pip install flask-swagger==0.2.12
diff --git a/docker/requirements.pip b/docker/requirements.pip
index b9336e8..d1724fb 100644
--- a/docker/requirements.pip
+++ b/docker/requirements.pip
@@ -8,6 +8,7 @@ python-keystoneclient==1.6.0
keystoneauth1==2.12.1
matplotlib==1.3.1
flask==0.10
+flask_cors==3.0.2
flask-restful==0.3.5
flask-restful-swagger==0.19
flask-swagger==0.2.12
diff --git a/rest_server.py b/rest_server.py
index 574fc32..f6075f9 100644
--- a/rest_server.py
+++ b/rest_server.py
@@ -13,6 +13,7 @@ import os
import sys
from flask import abort, Flask, request, jsonify, send_from_directory
+from flask_cors import CORS, cross_origin
from flask_restful import Resource, Api, fields
from flask_restful_swagger import swagger
@@ -22,6 +23,7 @@ from storperf.storperf_master import StorPerfMaster
app = Flask(__name__, static_url_path="")
+CORS(app)
api = swagger.docs(Api(app), apiVersion='1.0')
storperf = StorPerfMaster()