diff options
Diffstat (limited to 'share/newton_base')
-rw-r--r-- | share/newton_base/openoapi/tenants.py | 14 |
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: |