From 9ec0b9e66b6f276121c169725e8b1df3a30cba8c Mon Sep 17 00:00:00 2001 From: blue55 Date: Tue, 21 Mar 2017 14:19:33 +0800 Subject: [PATCH] Remove log translations Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: Ide6c0b2a565aa77b2bbef71c6652edf1e2ac2017 --- os_vif/__init__.py | 13 +++++-------- os_vif/i18n.py | 10 ---------- os_vif/objects/fields.py | 4 +--- vif_plug_ovs/i18n.py | 10 ---------- vif_plug_ovs/linux_net.py | 5 ++--- 5 files changed, 8 insertions(+), 34 deletions(-) diff --git a/os_vif/__init__.py b/os_vif/__init__.py index 780e1d21..b05b9efc 100644 --- a/os_vif/__init__.py +++ b/os_vif/__init__.py @@ -17,9 +17,6 @@ import os_vif.exception import os_vif.i18n import os_vif.objects -_LE = os_vif.i18n._LE -_LI = os_vif.i18n._LI - _EXT_MANAGER = None LOG = logging.getLogger(__name__) @@ -49,7 +46,7 @@ def initialize(reset=False): {'cls': cls, 'plugin_name': plugin_name}) loaded_plugins.append(plugin_name) _EXT_MANAGER[plugin_name].obj = obj - LOG.info(_LI("Loaded VIF plugins: %s"), ", ".join(loaded_plugins)) + LOG.info("Loaded VIF plugins: %s", ", ".join(loaded_plugins)) def plug(vif, instance_info): @@ -78,9 +75,9 @@ def plug(vif, instance_info): try: LOG.debug("Plugging vif %s", vif) plugin.plug(vif, instance_info) - LOG.info(_LI("Successfully plugged vif %s"), vif) + LOG.info("Successfully plugged vif %s", vif) except Exception as err: - LOG.error(_LE("Failed to plug vif %(vif)s"), + LOG.error("Failed to plug vif %(vif)s", {"vif": vif}, exc_info=True) raise os_vif.exception.PlugException(vif=vif, err=err) @@ -111,9 +108,9 @@ def unplug(vif, instance_info): try: LOG.debug("Unplugging vif %s", vif) plugin.unplug(vif, instance_info) - LOG.info(_LI("Successfully unplugged vif %s"), vif) + LOG.info("Successfully unplugged vif %s", vif) except Exception as err: - LOG.error(_LE("Failed to unplug vif %(vif)s"), + LOG.error("Failed to unplug vif %(vif)s", {"vif": vif}, exc_info=True) raise os_vif.exception.UnplugException(vif=vif, err=err) diff --git a/os_vif/i18n.py b/os_vif/i18n.py index e07d62f5..e5482b43 100644 --- a/os_vif/i18n.py +++ b/os_vif/i18n.py @@ -27,16 +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 -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical - def translate(value, user_locale): return oslo_i18n.translate(value, user_locale) diff --git a/os_vif/objects/fields.py b/os_vif/objects/fields.py index 1b034bf6..14c1c7d6 100644 --- a/os_vif/objects/fields.py +++ b/os_vif/objects/fields.py @@ -17,8 +17,6 @@ import re from oslo_versionedobjects import fields import six -from os_vif.i18n import _LE - class PCIAddress(fields.FieldType): @@ -30,7 +28,7 @@ class PCIAddress(fields.FieldType): newvalue = value.lower() if PCIAddress._REGEX.match(newvalue): return newvalue - raise ValueError(_LE("Malformed PCI address %s"), value) + raise ValueError("Malformed PCI address %s", value) class PCIAddressField(fields.AutoTypedField): diff --git a/vif_plug_ovs/i18n.py b/vif_plug_ovs/i18n.py index 8fcbf345..12f8bdc7 100644 --- a/vif_plug_ovs/i18n.py +++ b/vif_plug_ovs/i18n.py @@ -30,16 +30,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 -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical - def translate(value, user_locale): return oslo_i18n.translate(value, user_locale) diff --git a/vif_plug_ovs/linux_net.py b/vif_plug_ovs/linux_net.py index 2749d7ae..3f432969 100644 --- a/vif_plug_ovs/linux_net.py +++ b/vif_plug_ovs/linux_net.py @@ -28,7 +28,6 @@ from oslo_utils import excutils from vif_plug_ovs import constants from vif_plug_ovs import exception -from vif_plug_ovs.i18n import _LE from vif_plug_ovs import privsep LOG = logging.getLogger(__name__) @@ -42,7 +41,7 @@ def _ovs_vsctl(args, timeout=None): try: return processutils.execute(*full_args) except Exception as e: - LOG.error(_LE("Unable to execute %(cmd)s. Exception: %(exception)s"), + LOG.error("Unable to execute %(cmd)s. Exception: %(exception)s", {'cmd': full_args, 'exception': e}) raise exception.AgentError(method=full_args) @@ -105,7 +104,7 @@ def _delete_net_dev(dev): LOG.debug("Net device removed: '%s'", dev) except processutils.ProcessExecutionError: with excutils.save_and_reraise_exception(): - LOG.error(_LE("Failed removing net device: '%s'"), dev) + LOG.error("Failed removing net device: '%s'", dev) @privsep.vif_plug.entrypoint