Migrate to oslo.log
It's mostly a matter of changing imports to a new location.
Non-obvious changes needed:
* pass overwrite= argument to oslo_context since oslo.log reads context
from its thread local store and not local.store from incubator
* don't store context at local.store now that there is no code that
would consume it
* LOG.deprecated() -> versionutils.report_deprecated_feature()
* dropped LOG.audit check from hacking rule since now the method does
not exist
* WritableLogger is now located in oslo_log.loggers
Dropped log module from the tree. Also dropped local module that is now
of no use (and obsolete, as per oslo team).
Added versionutils back to openstack-common.conf since now we use the
module directly from neutron code and not just as a dependency of some
other oslo-incubator module.
Note: tempest tests are expected to be broken now, so instead of fixing
all the oslo.log related issues for the subtree in this patch, I only
added TODOs with directions for later fix.
Closes-Bug: #1425013
Change-Id: I310e059a815377579de6bb2aa204de168e72571e
diff --git a/neutron/tests/tempest/config.py b/neutron/tests/tempest/config.py
index deab890..569fc4b 100644
--- a/neutron/tests/tempest/config.py
+++ b/neutron/tests/tempest/config.py
@@ -18,10 +18,9 @@
import logging as std_logging
import os
-from oslo.config import cfg
-
from oslo_concurrency import lockutils
-from neutron.openstack.common import log as logging
+from oslo_config import cfg
+from oslo_log import log as logging
def register_opt_group(conf, opt_group, options):
@@ -1099,6 +1098,8 @@
register_opt_group(cfg.CONF, g, o)
+# TODO(ihrachys): this function should probably be removed since it's not used
+# anywhere, and accesses internal implementation details of olso libraries
def list_opts():
"""Return a list of oslo.config options available.
@@ -1197,7 +1198,7 @@
cfg.CONF([], project='tempest', default_config_files=config_files)
else:
cfg.CONF([], project='tempest')
- logging.setup('tempest')
+ logging.setup(cfg.CONF, 'tempest')
LOG = logging.getLogger('tempest')
LOG.info("Using tempest config file %s" % path)
register_opts()
@@ -1218,6 +1219,8 @@
def _fix_log_levels(self):
"""Tweak the oslo log defaults."""
+ # TODO(ihrachys): this code accesses internal details of oslo.log
+ # library (and does it wrong), hence should be fixed
for opt in logging.log_opts:
if opt.dest == 'default_log_levels':
opt.default.extend(self._extra_log_defaults)