diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-02-24 02:24:32 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-02-24 02:24:32 +0000 |
commit | 410d14ff05a2b1f8b3c1c94f3a4849af867fdceb (patch) | |
tree | 35bc3a8b6fc3c6c59a48507efdb6ed610e5d4717 /oslo_context | |
parent | f383bd2973c58c5272504603e4f9dddd55c5bb68 (diff) | |
parent | 217a4edc2e795a1b4e497395f112b80377cf3958 (diff) | |
download | oslo-context-410d14ff05a2b1f8b3c1c94f3a4849af867fdceb.tar.gz |
Merge "Revert "Add common oslo.log format parameters""
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 adad06d..9564abd 100644 --- a/oslo_context/context.py +++ b/oslo_context/context.py @@ -105,15 +105,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 eff31c9..6b18820 100644 --- a/oslo_context/tests/test_context.py +++ b/oslo_context/tests/test_context.py @@ -290,11 +290,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']) @@ -309,22 +304,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() |