Merge "API calls to Registry now maintain Request IDs"
This commit is contained in:
commit
02cf262293
@ -119,6 +119,7 @@ class ContextMiddleware(BaseContextMiddleware):
|
|||||||
'owner_is_tenant': CONF.owner_is_tenant,
|
'owner_is_tenant': CONF.owner_is_tenant,
|
||||||
'service_catalog': service_catalog,
|
'service_catalog': service_catalog,
|
||||||
'policy_enforcer': self.policy_enforcer,
|
'policy_enforcer': self.policy_enforcer,
|
||||||
|
'request_id': req.headers.get('X-Openstack-Request-ID'),
|
||||||
}
|
}
|
||||||
|
|
||||||
return glance.context.RequestContext(**kwargs)
|
return glance.context.RequestContext(**kwargs)
|
||||||
|
@ -138,6 +138,9 @@ def get_registry_client(cxt):
|
|||||||
'X-Service-Catalog': jsonutils.dumps(cxt.service_catalog),
|
'X-Service-Catalog': jsonutils.dumps(cxt.service_catalog),
|
||||||
}
|
}
|
||||||
kwargs['identity_headers'] = identity_headers
|
kwargs['identity_headers'] = identity_headers
|
||||||
|
|
||||||
|
kwargs['request_id'] = cxt.request_id
|
||||||
|
|
||||||
return client.RegistryClient(_CLIENT_HOST, _CLIENT_PORT,
|
return client.RegistryClient(_CLIENT_HOST, _CLIENT_PORT,
|
||||||
_METADATA_ENCRYPTION_KEY, **kwargs)
|
_METADATA_ENCRYPTION_KEY, **kwargs)
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ class RegistryClient(BaseClient):
|
|||||||
# settings when using keystone. configure_via_auth=False disables
|
# settings when using keystone. configure_via_auth=False disables
|
||||||
# this behaviour to ensure we still send requests to the Registry API
|
# this behaviour to ensure we still send requests to the Registry API
|
||||||
self.identity_headers = identity_headers
|
self.identity_headers = identity_headers
|
||||||
|
# store available passed request id for do_request call
|
||||||
|
self._passed_request_id = kwargs.pop('request_id', None)
|
||||||
BaseClient.__init__(self, host, port, configure_via_auth=False,
|
BaseClient.__init__(self, host, port, configure_via_auth=False,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
@ -112,6 +114,9 @@ class RegistryClient(BaseClient):
|
|||||||
try:
|
try:
|
||||||
kwargs['headers'] = kwargs.get('headers', {})
|
kwargs['headers'] = kwargs.get('headers', {})
|
||||||
kwargs['headers'].update(self.identity_headers or {})
|
kwargs['headers'].update(self.identity_headers or {})
|
||||||
|
if self._passed_request_id:
|
||||||
|
kwargs['headers']['X-Openstack-Request-ID'] = \
|
||||||
|
self._passed_request_id
|
||||||
res = super(RegistryClient, self).do_request(method,
|
res = super(RegistryClient, self).do_request(method,
|
||||||
action,
|
action,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user