diff options
author | Ronald Bradford <ronald.bradford@gmail.com> | 2016-02-23 18:53:54 +0000 |
---|---|---|
committer | Ronald Bradford <ronald.bradford@gmail.com> | 2016-02-23 18:53:54 +0000 |
commit | 217a4edc2e795a1b4e497395f112b80377cf3958 (patch) | |
tree | a5a369811298d6e7ee0ac83e3626d3c286441c8e /oslo_context | |
parent | 01aaeae060ce5fbc58672ed36f3346128623fcf1 (diff) | |
download | oslo-context-217a4edc2e795a1b4e497395f112b80377cf3958.tar.gz |
Revert "Add common oslo.log format parameters"
This reverts commit 01aaeae060ce5fbc58672ed36f3346128623fcf1.
This causes test failures with oslo.log change
Ica445ad5dfe9bd27dfcf1b1bcb6401a0bc9496a5 when passing these attributes
to a log message and a context object. The result of setting these in
context causes log.record values to be overridden with blank values.
Catering for this condition causes subsequent mismatches for test
conditions mixing context and optional passing additional attributes
to log.
Change-Id: I5450e105dc914f822a2b4c03b759a682d8b4a3e7
Diffstat (limited to 'oslo_context')
-rw-r--r-- | oslo_context/context.py | 10 | ||||
-rw-r--r-- | oslo_context/tests/test_context.py | 21 |
2 files changed, 1 insertions, 30 deletions
diff --git a/oslo_context/context.py b/oslo_context/context.py index 0458174..19bc1a3 100644 --- a/oslo_context/context.py +++ b/oslo_context/context.py @@ -102,15 +102,7 @@ class RequestContext(object): def get_logging_values(self): """Return a dictionary of logging specific context attributes.""" - # Define these attributes so that oslo.log does not throw an exception - # if used in any formatting strings - values = {'instance': '', - 'resource': '', - 'user_name': '', - 'project_name': '', - 'color': ''} - values.update(self.to_dict()) - + values = self.to_dict() return values @classmethod diff --git a/oslo_context/tests/test_context.py b/oslo_context/tests/test_context.py index 406e480..1a91023 100644 --- a/oslo_context/tests/test_context.py +++ b/oslo_context/tests/test_context.py @@ -261,11 +261,6 @@ class ContextTest(test_base.BaseTestCase): self.assertIn('request_id', d) self.assertIn('resource_uuid', d) self.assertIn('user_identity', d) - self.assertIn('instance', d) - self.assertIn('resource', d) - self.assertIn('user_name', d) - self.assertIn('project_name', d) - self.assertIn('color', d) self.assertEqual(auth_token, d['auth_token']) self.assertEqual(tenant, d['tenant']) @@ -280,22 +275,6 @@ class ContextTest(test_base.BaseTestCase): user_identity = "%s %s %s %s %s" % (user, tenant, domain, user_domain, project_domain) self.assertEqual(user_identity, d['user_identity']) - self.assertEqual("", d['instance']) - self.assertEqual("", d['resource']) - self.assertEqual("", d['user_name']) - self.assertEqual("", d['project_name']) - self.assertEqual("", d['color']) - - def test_get_logging_values_extra_attributes(self): - ctx = context.RequestContext() - d = ctx.get_logging_values() - self.assertEqual("", d['color']) - color = "red" - setattr(ctx, "color", color) - d = ctx.get_logging_values() - # Regardless of setting attribute, this is not affected as this - # is not included in to_dict(). - self.assertEqual("", d['color']) def test_dict_empty_user_identity(self): ctx = context.RequestContext() |