Merge "Drop "os" prefix for project id"

This commit is contained in:
Jenkins 2017-04-10 03:00:04 +00:00 committed by Gerrit Code Review
commit 5769f97e29
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