summaryrefslogtreecommitdiffstats
path: root/share/newton_base/openoapi
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-04-27 14:25:30 +0800
committerYun Huang <yun.huang@windriver.com>2018-04-27 14:25:30 +0800
commit70465cfc742890d76a6333ffd31d5e343a6a6873 (patch)
tree286fc8a460fcf9f04f0767f6c500c4db91feb3e6 /share/newton_base/openoapi
parent73333bf28802707d32cb550ac4b16dfe01f1af7d (diff)
Logging enhancement for openo tenants API
Change-Id: I1ba5dd5a6da3ee52b7499d46cfc9f0d13e36a9a0 Issue-ID: MULTICLOUD-178 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'share/newton_base/openoapi')
-rw-r--r--share/newton_base/openoapi/tenants.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/share/newton_base/openoapi/tenants.py b/share/newton_base/openoapi/tenants.py
index 926f72c5..db5cc8a8 100644
--- a/share/newton_base/openoapi/tenants.py
+++ b/share/newton_base/openoapi/tenants.py
@@ -37,7 +37,10 @@ class Tenants(APIView):
]
def get(self, request, vimid=""):
- logger.debug("Tenants--get::> %s" % request.data)
+ logger.info("vimid = %s" % vimid)
+ if request.data:
+ logger.debug("With data = %s" % request.data)
+ pass
try:
#prepare request resource to vim instance
query = VimDriverUtils.get_query_part(request)
@@ -48,7 +51,13 @@ class Tenants(APIView):
req_resouce = "/v2.0/tenants"
sess = VimDriverUtils.get_session(vim)
+ logger.info("making request with URI:%s" % req_resouce)
resp = sess.get(req_resouce, endpoint_filter=self.service)
+ logger.info("request returns with status %s" % resp.status_code)
+ if resp.status_code == status.HTTP_200_OK:
+ logger.debug("with content:%s" % resp.json())
+ pass
+
content = resp.json()
vim_dict = {
"vimName": vim["name"],
@@ -68,9 +77,10 @@ class Tenants(APIView):
for tenant in tmp:
if tenantname == tenant['name']:
content["tenants"].append(tenant)
-
+ logger.info("response with status = %s" % resp.status_code)
return Response(data=content, status=resp.status_code)
except VimDriverNewtonException as e:
+ logger.error("response with status = %s" % e.status_code)
return Response(
data={'error': e.content}, status=e.status_code)
except HttpError as e: