Fix The header X-PROJECT-ID missing bug

This patch fixex X-PROJECT-ID missing bug.

Change-Id: I8c13160f24f51a3f6588aefadae9ef8ff2519e1a
Co-Authored-By: XueFeng Liu <liu.xuefeng1@zte.com.cn>
Closes-Bug: #1668830
This commit is contained in:
zengjianfang 2017-03-02 17:25:03 +08:00 committed by jonnary
parent f2011c19a0
commit a0b6a79a3c
8 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@ def create_post_delete(queue_name, messages):
{'backend': 'keystone',
'options': {'os_username': 'zaqar',
'os_password': 'zaqar',
'os_project_id': 'ccad479c402f43a2994f6e372ab3f8fe',
'project_id': 'ccad479c402f43a2994f6e372ab3f8fe',
'os_project_name': '',
'os_auth_url': 'http://127.0.0.1:5000/v2.0/',
'insecure': ''}

View File

@ -34,7 +34,7 @@ def create_post_delete(queue_name, messages):
'expires': '',
'methods': ['GET', 'PATCH', 'POST', 'PUT'],
'paths': ['/v2/queues/beijing/claims'],
'os_project_id': '2887aabf368046a3bb0070f1c0413470'}
'project_id': '2887aabf368046a3bb0070f1c0413470'}
}
}
cli = client.Client(URL, conf=conf)

View File

@ -27,7 +27,7 @@ class TestRequest(base.TestBase):
def test_request_project_id(self):
auth_opts = {
'options': {
'os_project_id': 'my-project'
'project_id': 'my-project'
}
}
auth_opts.update({'backend': 'noauth'})

View File

@ -25,7 +25,7 @@ class TestWsTransport(base.TestBase):
os_opts = {
'os_auth_token': 'FAKE_TOKEN',
'os_auth_url': 'http://127.0.0.0:5000/v3',
'os_project_id': 'admin',
'project_id': 'admin',
'os_service_type': 'messaging-websocket',
}
auth_opts = {'backend': 'keystone',

View File

@ -37,7 +37,7 @@ class TestBase(testtools.TestCase):
'auth_opts': {
'backend': 'noauth',
'options': {
'os_project_id': 'my-project'
'project_id': 'my-project'
}
}
}
@ -90,7 +90,7 @@ class TestBase(testtools.TestCase):
options = {'os_username': self.creds['username'],
'os_password': self.creds['password'],
'os_project_name': self.creds['project_name'],
'os_project_id': '',
'project_id': '',
'os_auth_url': auth_url}
self.conf['auth_opts'].setdefault('options', {}).update(options)

View File

@ -600,7 +600,7 @@ class QueuesV2QueueFunctionalTest(QueuesV1_1QueueFunctionalTest):
'expires': signature['expires'],
'methods': signature['methods'],
'signature': signature['signature'],
'os_project_id': signature['project'],
'project_id': signature['project'],
}
auth_opts = {'backend': 'signed-url',
'options': opts}

View File

@ -45,7 +45,7 @@ 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', {})
project_id = auth_opts.get('options', {}).get('project_id', None)
# Let's add project id header, only if it will have non-empty value.
if project_id:

View File

@ -42,7 +42,7 @@ class WebsocketTransport(base.Transport):
'backend': 'keystone',
'options': {
'os_auth_token': ks.auth_token,
'os_project_id': CONF.zaqar.project_id
'project_id': CONF.zaqar.project_id
}
}
}
@ -57,7 +57,7 @@ class WebsocketTransport(base.Transport):
"""
def __init__(self, options):
super(WebsocketTransport, self).__init__(options)
self._project_id = options['auth_opts']['options']['os_project_id']
self._project_id = options['auth_opts']['options']['project_id']
self._token = options['auth_opts']['options']['os_auth_token']
self._websocket_client_id = None
self._ws = None