trivial: Remove remaining '_LI' instances

Once again, do what we did for '_LE' and '_LW' and remove the final
remnants of the log translation effort.

Change-Id: Id6cf7a9bfbe69d6d3e65303e62403d1db9188a84
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2020-05-18 17:00:02 +01:00
parent 3a28b0e771
commit d565e7a092
8 changed files with 24 additions and 34 deletions

View File

@ -19,7 +19,6 @@ Filter support
from oslo_log import log as logging
from nova.i18n import _LI
from nova import loadables
LOG = logging.getLogger(__name__)
@ -96,11 +95,10 @@ class BaseFilterHandler(loadables.BaseLoader):
for obj in list_objs]
full_filter_results.append((cls_name, remaining))
else:
LOG.info(_LI("Filter %s returned 0 hosts"), cls_name)
LOG.info("Filter %s returned 0 hosts", cls_name)
full_filter_results.append((cls_name, None))
break
LOG.debug("Filter %(cls_name)s returned "
"%(obj_len)d host(s)",
LOG.debug("Filter %(cls_name)s returned %(obj_len)d host(s)",
{'cls_name': cls_name, 'obj_len': len(list_objs)})
if not list_objs:
# Log the filtration history

View File

@ -788,8 +788,8 @@ def no_log_warn(logical_line):
def check_context_log(logical_line, filename, noqa):
"""check whether context is being passed to the logs
Not correct: LOG.info(_LI("Rebooting instance"), context=context)
Correct: LOG.info(_LI("Rebooting instance"))
Not correct: LOG.info("Rebooting instance", context=context)
Correct: LOG.info("Rebooting instance")
https://bugs.launchpad.net/nova/+bug/1500896
N353

View File

@ -27,13 +27,6 @@ _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
def translate(value, user_locale):
return oslo_i18n.translate(value, user_locale)

View File

@ -34,7 +34,7 @@ import nova.conf
from nova import context
from nova import debugger
from nova import exception
from nova.i18n import _, _LI
from nova.i18n import _
from nova import objects
from nova.objects import base as objects_base
from nova.objects import service as service_obj
@ -71,8 +71,8 @@ def _create_service_ref(this_service, context):
def _update_service_ref(service):
if service.version != service_obj.SERVICE_VERSION:
LOG.info(_LI('Updating service version for %(binary)s on '
'%(host)s from %(old)i to %(new)i'),
LOG.info('Updating service version for %(binary)s on '
'%(host)s from %(old)i to %(new)i',
{'binary': service.binary,
'host': service.host,
'old': service.version,
@ -89,7 +89,7 @@ def setup_profiler(binary, host):
project="nova",
service=binary,
host=host)
LOG.info(_LI("OSProfiler is enabled."))
LOG.info("OSProfiler is enabled.")
def assert_eventlet_uses_monotonic_clock():
@ -166,7 +166,7 @@ class Service(service.Service):
assert_eventlet_uses_monotonic_clock()
verstr = version.version_string_with_package()
LOG.info(_LI('Starting %(topic)s node (version %(version)s)'),
LOG.info('Starting %(topic)s node (version %(version)s)',
{'topic': self.topic, 'version': verstr})
self.basic_config_check()
self.manager.init_host()

View File

@ -20,7 +20,7 @@ import six
import nova.conf
from nova import exception
from nova.i18n import _, _LI
from nova.i18n import _
from nova.servicegroup import api
from nova.servicegroup.drivers import base
@ -95,8 +95,7 @@ class DbDriver(base.Driver):
# TODO(termie): make this pattern be more elegant.
if getattr(service, 'model_disconnected', False):
service.model_disconnected = False
LOG.info(
_LI('Recovered from being unable to report status.'))
LOG.info('Recovered from being unable to report status.')
except messaging.MessagingTimeout:
# NOTE(johngarbutt) during upgrade we will see messaging timeouts
# as nova-conductor is restarted, so only log this error once.

View File

@ -23,7 +23,7 @@ from oslo_utils import timeutils
from nova import cache_utils
import nova.conf
from nova.i18n import _, _LI
from nova.i18n import _
from nova.servicegroup import api
from nova.servicegroup.drivers import base
@ -101,8 +101,9 @@ class MemcachedDriver(base.Driver):
if getattr(service, 'model_disconnected', False):
service.model_disconnected = False
LOG.info(
_LI('Recovered connection to memcache server '
'for reporting service status.'))
'Recovered connection to memcache server for reporting '
'service status.'
)
# TODO(vish): this should probably only catch connection errors
except Exception:

View File

@ -709,22 +709,21 @@ class HackingTestCase(test.NoDBTestCase):
def test_log_context(self):
code = """
LOG.info(_LI("Rebooting instance"),
context=context, instance=instance)
LOG.info("Rebooting instance",
context=context, instance=instance)
"""
errors = [(1, 0, 'N353')]
self._assert_has_errors(code, checks.check_context_log,
expected_errors=errors)
code = """
LOG.info(_LI("Rebooting instance"),
context=admin_context, instance=instance)
LOG.info("Rebooting instance",
context=admin_context, instance=instance)
"""
errors = [(1, 0, 'N353')]
self._assert_has_errors(code, checks.check_context_log,
expected_errors=errors)
code = """
LOG.info(_LI("Rebooting instance"),
instance=instance)
LOG.info("Rebooting instance", instance=instance)
"""
self._assert_has_no_errors(code, checks.check_context_log)

View File

@ -30,7 +30,7 @@ from oslo_utils import excutils
import nova.conf
from nova import exception
from nova.i18n import _, _LI
from nova.i18n import _
from nova import utils
CONF = nova.conf.CONF
@ -97,7 +97,7 @@ class Server(service.ServiceBase):
raise
(self.host, self.port) = self._socket.getsockname()[0:2]
LOG.info(_LI("%(name)s listening on %(host)s:%(port)s"),
LOG.info("%(name)s listening on %(host)s:%(port)s",
{'name': self.name, 'host': self.host, 'port': self.port})
def start(self):
@ -202,7 +202,7 @@ class Server(service.ServiceBase):
:returns: None
"""
LOG.info(_LI("Stopping WSGI server."))
LOG.info("Stopping WSGI server.")
if self._server is not None:
# Resize pool to stop new requests from being processed
@ -222,4 +222,4 @@ class Server(service.ServiceBase):
self._pool.waitall()
self._server.wait()
except greenlet.GreenletExit:
LOG.info(_LI("WSGI server has stopped."))
LOG.info("WSGI server has stopped.")