summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2017-10-10 18:26:18 +0800
committerBin Yang <bin.yang@windriver.com>2017-10-10 18:26:18 +0800
commitd8a7b383479d281b175c326b63dec84284cf8077 (patch)
tree3084db0aac950dab5e07b273007c2c84806b850b
parente487cd90e97edb6b085e03de93b169756b41b882 (diff)
Fix bug of OpenStack Proxy
Add query back to SBI, add header to claim formats Change-Id: Ie507c98e7e5c1aa5c97cf451a945621192367c99 Issue-Id: MULTICLOUD-109 Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r--newton/newton/proxy/views/services.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/newton/newton/proxy/views/services.py b/newton/newton/proxy/views/services.py
index b6e1be0c..d86b0e8c 100644
--- a/newton/newton/proxy/views/services.py
+++ b/newton/newton/proxy/views/services.py
@@ -99,17 +99,34 @@ class Services(APIView):
'region_id': regionid
}
+ querystr = VimDriverUtils.get_query_part(request)
+ if querystr:
+ req_resource += "?" + querystr
+
self._logger.debug("service " + action + " request uri %s" % (req_resource))
if(action == "get"):
- resp = sess.get(req_resource, endpoint_filter=service)
+ resp = sess.get(req_resource, endpoint_filter=service,
+ headers={"Content-Type": "application/json",
+ "Accept": "application/json"})
elif(action == "post"):
- resp = sess.post(req_resource, data=json.JSONEncoder().encode(request.data), endpoint_filter=service)
+ resp = sess.post(req_resource, data=json.JSONEncoder().encode(request.data),
+ endpoint_filter=service,
+ headers={"Content-Type": "application/json",
+ "Accept": "application/json"})
elif(action == "put"):
- resp = sess.put(req_resource, data=json.JSONEncoder().encode(request.data), endpoint_filter=service)
+ resp = sess.put(req_resource, data=json.JSONEncoder().encode(request.data),
+ endpoint_filter=service,
+ headers={"Content-Type": "application/json",
+ "Accept": "application/json"})
elif(action == "patch"):
- resp = sess.patch(req_resource, data=json.JSONEncoder().encode(request.data), endpoint_filter=service)
+ resp = sess.patch(req_resource, data=json.JSONEncoder().encode(request.data),
+ endpoint_filter=service,
+ headers={"Content-Type": "application/json",
+ "Accept": "application/json"})
elif (action == "delete"):
- resp = sess.delete(req_resource, endpoint_filter=service)
+ resp = sess.delete(req_resource, endpoint_filter=service,
+ headers={"Content-Type": "application/json",
+ "Accept": "application/json"})
content = resp.json() if resp.content else None
self._logger.debug("service " + action + " response: %s, %s" % (resp.status_code, content))