diff options
author | Bin Yang <bin.yang@windriver.com> | 2018-09-11 08:14:32 +0000 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2018-09-11 08:14:32 +0000 |
commit | 369f9fe4e053815477adb367140480f02ca357df (patch) | |
tree | d67d254ba2f318edffe358b9e4c0d5b025d889fe | |
parent | 676ec47b90e7d98b3bf6655578e1c22b04c6e3a9 (diff) |
Return the default tenant in case of no privilege
Change-Id: Ic4b2e6bb787ba4075a906e70c28ef42289255345
Issue-ID: MULTICLOUD-356
Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r-- | share/newton_base/proxy/services.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/share/newton_base/proxy/services.py b/share/newton_base/proxy/services.py index 6aa1bbce..36ae9840 100644 --- a/share/newton_base/proxy/services.py +++ b/share/newton_base/proxy/services.py @@ -269,7 +269,28 @@ class GetTenants(Services): return Response(headers={'X-Subject-Token': tmp_auth_token}, data={'tenants': content['projects'],'tenants_links':[]}, status=resp.status_code) else: - return resp + viminfo = VimDriverUtils.get_vim_info(vimid) + session = VimDriverUtils.get_session( + viminfo, tenant_name=viminfo['tenant']) + tmp_auth_state = VimDriverUtils.get_auth_state(session) + tmp_auth_info = json.loads(tmp_auth_state) + tmp_auth_data = tmp_auth_info['body'] + tenant = tmp_auth_data['token']['project'] + content = {'projects': [ + { + 'is_domain': False, + 'description': 'tenant info provisioned by VIM onborading', + 'enabled': True, + 'domain_id': viminfo['domain'], + 'parent_id': 'default', + 'id': tenant['id'], + 'name': tenant['name'] + } + ]} + return Response(headers={'X-Subject-Token': tmp_auth_token}, data={'tenants': content['projects'],'tenants_links':[]}, + status=status.HTTP_200_OK) + + # return resp def head(self, request, vimid="", servicetype="", requri=""): self._logger.warn("wrong request with vimid, servicetype, requri> %s,%s,%s" |