diff options
author | Davanum Srinivas <davanum@gmail.com> | 2017-01-29 10:29:00 -0500 |
---|---|---|
committer | Davanum Srinivas <davanum@gmail.com> | 2017-01-29 15:28:38 -0500 |
commit | 96432cbe4d3ed7c6ea80c70786f8b406a488f5db (patch) | |
tree | 4d7482b09ef851b6e3630f33482ced95ef69497a /oslo_context | |
parent | 5288c6d9200acabd82f6cdc86634a34b50627252 (diff) | |
download | oslo-context-96432cbe4d3ed7c6ea80c70786f8b406a488f5db.tar.gz |
Postpone deprecation warnings to Pike
2.12.0 added a DeprecationWarning a bit late in
Ocata for other projects to react properly. For example
Neutron logs get filled up pretty badly. So let's
defer the deprecation warnings for one more release
Note f25543fcc792ebf155728a91fde06e8dc4e96cea adds
the warning(s).
Instead of a full revert, let's just key off of a
variable _log_deprecation_warnings both in context.py
and test_context.py with a FIXME reminder
Closes-Bug: #1660088
Change-Id: I45ba9a0ed628f3347c7c3b346e907e4363452dd8
Diffstat (limited to 'oslo_context')
-rw-r--r-- | oslo_context/context.py | 15 | ||||
-rw-r--r-- | oslo_context/tests/test_context.py | 15 |
2 files changed, 20 insertions, 10 deletions
diff --git a/oslo_context/context.py b/oslo_context/context.py index 8ec3c10..945cb82 100644 --- a/oslo_context/context.py +++ b/oslo_context/context.py @@ -35,7 +35,6 @@ import warnings import debtcollector from positional import positional - _request_store = threading.local() # These arguments will be passed to a new context from the first available @@ -131,16 +130,22 @@ class _DeprecatedPolicyValues(collections.MutableMapping): return d +# FIXME(dims): Skip deprecation warnings until Pike (Version 2.14) +_log_deprecation_warnings = False + + def _moved_msg(new_name, old_name): if old_name: deprecated_msg = "Property '%(old_name)s' has moved to '%(new_name)s'" deprecated_msg = deprecated_msg % {'old_name': old_name, 'new_name': new_name} - debtcollector.deprecate(deprecated_msg, - version='2.6', - removal_version='3.0', - stacklevel=5) + # FIXME(dims): Skip deprecation warnings until Pike (Version 2.14) + if _log_deprecation_warnings: + debtcollector.deprecate(deprecated_msg, + version='2.6', + removal_version='3.0', + stacklevel=5) def _moved_property(new_name, old_name=None, target=None): diff --git a/oslo_context/tests/test_context.py b/oslo_context/tests/test_context.py index c8bf283..f6486b7 100644 --- a/oslo_context/tests/test_context.py +++ b/oslo_context/tests/test_context.py @@ -606,12 +606,17 @@ class ContextTest(test_base.BaseTestCase): self.assertEqual(0, len(self.warnings)) self.assertEqual(user, ctx.user) - self.assertEqual(1, len(self.warnings)) + if context._log_deprecation_warnings: + self.assertEqual(1, len(self.warnings)) self.assertEqual(tenant, ctx.tenant) - self.assertEqual(2, len(self.warnings)) + if context._log_deprecation_warnings: + self.assertEqual(2, len(self.warnings)) self.assertEqual(domain, ctx.domain) - self.assertEqual(3, len(self.warnings)) + if context._log_deprecation_warnings: + self.assertEqual(3, len(self.warnings)) self.assertEqual(user_domain, ctx.user_domain) - self.assertEqual(4, len(self.warnings)) + if context._log_deprecation_warnings: + self.assertEqual(4, len(self.warnings)) self.assertEqual(project_domain, ctx.project_domain) - self.assertEqual(5, len(self.warnings)) + if context._log_deprecation_warnings: + self.assertEqual(5, len(self.warnings)) |