Fix setting 'global_request_id' in SessionClient

In Ic75be3acb8b77aae8da631e3c4cd6f545a9a35cb,
'global_request_id' is set
in the constructor of class keystoneauth1.adaptor.Adapter.

But 'global_request_id' was not passed to the constructor,
'global_request_id' was cleared.
It caused the test failure.

It is not necessary to set 'global_request_id'
in the constructor of class SessionClient
and just passing 'global_request_id' in kwargs
is required.

Change-Id: Id587e35c221fe2b11889469f88557d254125ea7e
Closes-Bug: #1697358
This commit is contained in:
Takashi NATSUME
2017-06-12 15:10:05 +09:00
committed by Sean Dague
parent e62d1e50b7
commit 264c22a9cc
2 changed files with 1 additions and 6 deletions

View File

@@ -40,7 +40,6 @@ from novaclient import extension as ext
from novaclient.i18n import _
from novaclient import utils
REQ_ID_HEADER = 'X-OpenStack-Request-ID'
# TODO(jichenjc): when an extension in contrib is moved to core extension,
# Add the name into the following list, then after last patch merged,
# remove the whole function
@@ -57,16 +56,12 @@ class SessionClient(adapter.LegacyJsonAdapter):
self.timings = kwargs.pop('timings', False)
self.api_version = kwargs.pop('api_version', None)
self.api_version = self.api_version or api_versions.APIVersion()
self.global_request_id = kwargs.pop('global_request_id', None)
super(SessionClient, self).__init__(*args, **kwargs)
def request(self, url, method, **kwargs):
kwargs.setdefault('headers', kwargs.get('headers', {}))
api_versions.update_headers(kwargs["headers"], self.api_version)
if self.global_request_id is not None:
kwargs['headers'].setdefault(REQ_ID_HEADER, self.global_request_id)
# NOTE(dbelova): osprofiler_web.get_trace_id_headers does not add any
# headers in case if osprofiler is not initialized.
if osprofiler_web:

View File

@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
keystoneauth1>=2.20.0 # Apache-2.0
keystoneauth1>=2.21.0 # Apache-2.0
iso8601>=0.1.11 # MIT
oslo.i18n!=3.15.2,>=2.1.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0