Make code follow log translation guideline
Since Pike log messages should not be translated. This patch removes calls to i18n _LC, _LI, _LE, _LW from logging logic throughout the code. Translators definition from neutron._i18n is removed as well. This patch also removes log translation verification from ignore directive in tox.ini. Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
This commit is contained in:
committed by
Akihiro Motoki
parent
c65e541b6e
commit
7322bd6efb
@@ -22,7 +22,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron._i18n import _LE, _LW
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
@@ -105,9 +104,9 @@ class DhcpAgentNotifyAPI(object):
|
||||
context, 'network_create_end',
|
||||
{'network': {'id': network['id']}}, agent['host'])
|
||||
elif not existing_agents:
|
||||
LOG.warning(_LW('Unable to schedule network %s: no agents '
|
||||
'available; will retry on subsequent port '
|
||||
'and subnet creation events.'),
|
||||
LOG.warning('Unable to schedule network %s: no agents '
|
||||
'available; will retry on subsequent port '
|
||||
'and subnet creation events.',
|
||||
network['id'])
|
||||
return new_agents + existing_agents
|
||||
|
||||
@@ -123,10 +122,10 @@ class DhcpAgentNotifyAPI(object):
|
||||
len_enabled_agents = len(enabled_agents)
|
||||
len_active_agents = len(active_agents)
|
||||
if len_active_agents < len_enabled_agents:
|
||||
LOG.warning(_LW("Only %(active)d of %(total)d DHCP agents "
|
||||
"associated with network '%(net_id)s' "
|
||||
"are marked as active, so notifications "
|
||||
"may be sent to inactive agents."),
|
||||
LOG.warning("Only %(active)d of %(total)d DHCP agents "
|
||||
"associated with network '%(net_id)s' "
|
||||
"are marked as active, so notifications "
|
||||
"may be sent to inactive agents.",
|
||||
{'active': len_active_agents,
|
||||
'total': len_enabled_agents,
|
||||
'net_id': network_id})
|
||||
@@ -136,9 +135,9 @@ class DhcpAgentNotifyAPI(object):
|
||||
notification_required = (
|
||||
num_ports > 0 and len(network['subnets']) >= 1)
|
||||
if notification_required:
|
||||
LOG.error(_LE("Will not send event %(method)s for network "
|
||||
"%(net_id)s: no agent available. Payload: "
|
||||
"%(payload)s"),
|
||||
LOG.error("Will not send event %(method)s for network "
|
||||
"%(net_id)s: no agent available. Payload: "
|
||||
"%(payload)s",
|
||||
{'method': method,
|
||||
'net_id': network_id,
|
||||
'payload': payload})
|
||||
|
||||
@@ -21,7 +21,6 @@ from neutron_lib.plugins import directory
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron._i18n import _LE
|
||||
from neutron.api.rpc.agentnotifiers import utils as ag_utils
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
@@ -88,8 +87,8 @@ class L3AgentNotifyAPI(object):
|
||||
"""Notify all the agents that are hosting the routers."""
|
||||
plugin = directory.get_plugin(plugin_constants.L3)
|
||||
if not plugin:
|
||||
LOG.error(_LE('No plugin for L3 routing registered. Cannot notify '
|
||||
'agents with the message %s'), method)
|
||||
LOG.error('No plugin for L3 routing registered. Cannot notify '
|
||||
'agents with the message %s', method)
|
||||
return
|
||||
if utils.is_extension_supported(
|
||||
plugin, constants.L3_AGENT_SCHEDULER_EXT_ALIAS):
|
||||
|
||||
@@ -17,8 +17,6 @@ from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron._i18n import _LW
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -42,8 +40,8 @@ def _call_with_retry(max_attempts):
|
||||
with excutils.save_and_reraise_exception(
|
||||
reraise=False) as ctxt:
|
||||
LOG.warning(
|
||||
_LW('Failed to execute %(action)s. %(attempt)d out'
|
||||
' of %(max_attempts)d'),
|
||||
'Failed to execute %(action)s. %(attempt)d out'
|
||||
' of %(max_attempts)d',
|
||||
{'attempt': attempt,
|
||||
'max_attempts': max_attempts,
|
||||
'action': action})
|
||||
|
||||
@@ -28,7 +28,7 @@ from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron._i18n import _, _LW
|
||||
from neutron._i18n import _
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import utils
|
||||
@@ -120,9 +120,9 @@ class DhcpRpcCallback(object):
|
||||
ctxt.reraise = True
|
||||
if ctxt.reraise:
|
||||
net_id = port['port']['network_id']
|
||||
LOG.warning(_LW("Action %(action)s for network %(net_id)s "
|
||||
"could not complete successfully: "
|
||||
"%(reason)s"),
|
||||
LOG.warning("Action %(action)s for network %(net_id)s "
|
||||
"could not complete successfully: "
|
||||
"%(reason)s",
|
||||
{"action": action,
|
||||
"net_id": net_id,
|
||||
'reason': e})
|
||||
|
||||
@@ -19,7 +19,6 @@ from neutron_lib.utils import net
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron._i18n import _LW
|
||||
from neutron.api.rpc.handlers import resources_rpc
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
@@ -192,9 +191,9 @@ class SecurityGroupAgentRpcCallbackMixin(object):
|
||||
sg_agent = None
|
||||
|
||||
def _security_groups_agent_not_set(self):
|
||||
LOG.warning(_LW("Security group agent binding currently not set. "
|
||||
"This should be set by the end of the init "
|
||||
"process."))
|
||||
LOG.warning("Security group agent binding currently not set. "
|
||||
"This should be set by the end of the init "
|
||||
"process.")
|
||||
|
||||
def security_groups_rule_updated(self, context, **kwargs):
|
||||
"""Callback for security group rule update.
|
||||
|
||||
Reference in New Issue
Block a user