Drop "os" prefix for project id

Keystone session now returns project id without "os" prefix.
We should drop it as well.

Closes-bug: #1668830
Change-Id: I4ad9d0696c362723c4de7f7283105ba6f396fa96
Co-Authored-By: XueFeng Liu <liu.xuefeng1@zte.com.cn>
This commit is contained in:
wangxiyuan 2017-03-08 10:50:42 +08:00
parent d19198c65e
commit 977414d058
3 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- The "os" prefix for project id has been dropped to keep the same with
OpenStack and Keystone Client. To keep the backwards compatibility, the "os"
prefix still can be used. And it'll be removed in the next release.

View File

@ -45,7 +45,10 @@ def prepare_request(auth_opts=None, data=None, **kwargs):
auth_backend = auth.get_backend(**(auth_opts or {}))
req = auth_backend.authenticate(kwargs.get('api'), req)
project_id = auth_opts.get('options', {}).get('os_project_id', {})
option = auth_opts.get('options', {})
# TODO(wangxiyuan): To keep backwards compatibility, we leave
# "os_project_id" here. Remove it in the next release.
project_id = option.get('os_project_id', option.get('project_id'))
# Let's add project id header, only if it will have non-empty value.
if project_id:

View File

@ -57,7 +57,11 @@ class WebsocketTransport(base.Transport):
"""
def __init__(self, options):
super(WebsocketTransport, self).__init__(options)
self._project_id = options['auth_opts']['options']['os_project_id']
option = options['auth_opts']['options']
# TODO(wangxiyuan): To keep backwards compatibility, we leave
# "os_project_id" here. Remove it in the next release.
self._project_id = option.get('os_project_id',
option.get('project_id'))
self._token = options['auth_opts']['options']['os_auth_token']
self._websocket_client_id = None
self._ws = None