diff options
author | Bin Yang <bin.yang@windriver.com> | 2018-09-11 13:01:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-11 13:01:42 +0000 |
commit | 7c1f75989e8cc63fd3542acf546fc77c90aa6327 (patch) | |
tree | c04e930c1f5ada93fe09f806f3bbfc5b10a98843 | |
parent | 4caa99144fefa576136ff700ea246fa9705c3206 (diff) | |
parent | 369f9fe4e053815477adb367140480f02ca357df (diff) |
Merge "Return the default tenant in case of no privilege"
-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" |