Don't use oslo context get_logging_values

get_logging_values has been changed recently to not pass the token
anymore, call to_dict as expected.

Change-Id: I3a7f1293a4d0082274af270f86b5c732d898f8bc
Closes-Bug: #1733345
This commit is contained in:
Thomas Herve 2017-11-24 14:52:42 +01:00
parent bec878eb89
commit a944cdb98e
3 changed files with 11 additions and 11 deletions

View File

@ -53,16 +53,16 @@ class MistralContext(oslo_context.RequestContext):
# using the variable provided by oslo_context in future.
super(MistralContext, self).__init__(overwrite=False, **kwargs)
def convert_to_dict(self):
"""Return a dictionary of context attributes.
Use get_logging_values() instead of to_dict() from parent class to get
more information from the context. This method is not named "to_dict"
to avoid recursive call.
"""
ctx_dict = self.get_logging_values()
def to_dict(self):
"""Return a dictionary of context attributes."""
ctx_dict = super(MistralContext, self).to_dict()
ctx_dict.update(
{
'user_name': self.user_name,
'project_name': self.project_name,
'domain_name': self.domain_name,
'user_domain_name': self.user_domain_name,
'project_domain_name': self.project_domain_name,
'auth_uri': self.auth_uri,
'auth_cacert': self.auth_cacert,
'insecure': self.insecure,
@ -198,7 +198,7 @@ class RpcContextSerializer(messaging.Serializer):
return self.entity_serializer.deserialize(entity)
def serialize_context(self, context):
ctx = context.convert_to_dict()
ctx = context.to_dict()
pfr = profiler.get()

View File

@ -132,7 +132,7 @@ class KombuRPCClient(rpc_base.RPCClient, kombu_base.Base):
correlation_id = utils.generate_unicode_uuid()
body = {
'rpc_ctx': ctx.convert_to_dict(),
'rpc_ctx': ctx.to_dict(),
'rpc_method': method,
'arguments': self._serialize_message(kwargs),
'async': async_

View File

@ -51,7 +51,7 @@ class KombuClientTestCase(base.KombuTestCase):
self.ctx = type(
'context',
(object,),
{'convert_to_dict': lambda self: {}}
{'to_dict': lambda self: {}}
)()
def test_sync_call_result_get(self):