diff --git a/neutron/api/api_common.py b/neutron/api/api_common.py index e370e2e5a9..d90d6440b9 100644 --- a/neutron/api/api_common.py +++ b/neutron/api/api_common.py @@ -20,6 +20,7 @@ from webob import exc from neutron.common import constants from neutron.common import exceptions +from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging @@ -98,8 +99,8 @@ def _get_pagination_max_limit(): if max_limit == 0: raise ValueError() except ValueError: - LOG.warn(_("Invalid value for pagination_max_limit: %s. It " - "should be an integer greater to 0"), + LOG.warn(_LW("Invalid value for pagination_max_limit: %s. It " + "should be an integer greater to 0"), cfg.CONF.pagination_max_limit) return max_limit diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index fe075df5af..3a406a0ab6 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -28,6 +28,7 @@ import webob.exc from neutron.common import exceptions import neutron.extensions from neutron import manager +from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.openstack.common import log as logging from neutron import policy from neutron import wsgi @@ -279,7 +280,7 @@ class ExtensionMiddleware(wsgi.Middleware): (resource.parent["collection_name"], resource.parent["member_name"])) - LOG.debug(_('Extended resource: %s'), + LOG.debug('Extended resource: %s', resource.collection) for action, method in resource.collection_actions.iteritems(): conditions = dict(method=[method]) @@ -301,7 +302,7 @@ class ExtensionMiddleware(wsgi.Middleware): action_controllers = self._action_ext_controllers(application, self.ext_mgr, mapper) for action in self.ext_mgr.get_actions(): - LOG.debug(_('Extended action: %s'), action.action_name) + LOG.debug('Extended action: %s', action.action_name) controller = action_controllers[action.collection] controller.add_action(action.action_name, action.handler) @@ -309,7 +310,7 @@ class ExtensionMiddleware(wsgi.Middleware): req_controllers = self._request_ext_controllers(application, self.ext_mgr, mapper) for request_ext in self.ext_mgr.get_request_extensions(): - LOG.debug(_('Extended request: %s'), request_ext.key) + LOG.debug('Extended request: %s', request_ext.key) controller = req_controllers[request_ext.key] controller.add_handler(request_ext.handler) @@ -399,7 +400,7 @@ class ExtensionManager(object): """ def __init__(self, path): - LOG.info(_('Initializing extension manager.')) + LOG.info(_LI('Initializing extension manager.')) self.path = path self.extensions = {} self._load_all_extensions() @@ -479,8 +480,8 @@ class ExtensionManager(object): else: attr_map[resource] = resource_attrs except AttributeError: - LOG.exception(_("Error fetching extended attributes for " - "extension '%s'"), ext.get_name()) + LOG.exception(_LE("Error fetching extended attributes for " + "extension '%s'"), ext.get_name()) processed_exts.add(ext_name) del exts_to_process[ext_name] if len(processed_exts) == processed_ext_count: @@ -488,8 +489,8 @@ class ExtensionManager(object): break if exts_to_process: # NOTE(salv-orlando): Consider whether this error should be fatal - LOG.error(_("It was impossible to process the following " - "extensions: %s because of missing requirements."), + LOG.error(_LE("It was impossible to process the following " + "extensions: %s because of missing requirements."), ','.join(exts_to_process.keys())) # Extending extensions' attributes map. @@ -499,13 +500,13 @@ class ExtensionManager(object): def _check_extension(self, extension): """Checks for required methods in extension objects.""" try: - LOG.debug(_('Ext name: %s'), extension.get_name()) - LOG.debug(_('Ext alias: %s'), extension.get_alias()) - LOG.debug(_('Ext description: %s'), extension.get_description()) - LOG.debug(_('Ext namespace: %s'), extension.get_namespace()) - LOG.debug(_('Ext updated: %s'), extension.get_updated()) + LOG.debug('Ext name: %s', extension.get_name()) + LOG.debug('Ext alias: %s', extension.get_alias()) + LOG.debug('Ext description: %s', extension.get_description()) + LOG.debug('Ext namespace: %s', extension.get_namespace()) + LOG.debug('Ext updated: %s', extension.get_updated()) except AttributeError as ex: - LOG.exception(_("Exception loading extension: %s"), unicode(ex)) + LOG.exception(_LE("Exception loading extension: %s"), unicode(ex)) return False return True @@ -523,7 +524,7 @@ class ExtensionManager(object): if os.path.exists(path): self._load_all_extensions_from_path(path) else: - LOG.error(_("Extension path '%s' doesn't exist!"), path) + LOG.error(_LE("Extension path '%s' doesn't exist!"), path) def _load_all_extensions_from_path(self, path): # Sorting the extension list makes the order in which they @@ -531,7 +532,7 @@ class ExtensionManager(object): # Neutron Servers for f in sorted(os.listdir(path)): try: - LOG.debug(_('Loading extension file: %s'), f) + LOG.debug('Loading extension file: %s', f) mod_name, file_ext = os.path.splitext(os.path.split(f)[-1]) ext_path = os.path.join(path, f) if file_ext.lower() == '.py' and not mod_name.startswith('_'): @@ -539,16 +540,17 @@ class ExtensionManager(object): ext_name = mod_name[0].upper() + mod_name[1:] new_ext_class = getattr(mod, ext_name, None) if not new_ext_class: - LOG.warn(_('Did not find expected name ' - '"%(ext_name)s" in %(file)s'), + LOG.warn(_LW('Did not find expected name ' + '"%(ext_name)s" in %(file)s'), {'ext_name': ext_name, 'file': ext_path}) continue new_ext = new_ext_class() self.add_extension(new_ext) except Exception as exception: - LOG.warn(_("Extension file %(f)s wasn't loaded due to " - "%(exception)s"), {'f': f, 'exception': exception}) + LOG.warn(_LW("Extension file %(f)s wasn't loaded due to " + "%(exception)s"), + {'f': f, 'exception': exception}) def add_extension(self, ext): # Do nothing if the extension doesn't check out @@ -556,7 +558,7 @@ class ExtensionManager(object): return alias = ext.get_alias() - LOG.info(_('Loaded extension: %s'), alias) + LOG.info(_LI('Loaded extension: %s'), alias) if alias in self.extensions: raise exceptions.DuplicatedExtension(alias=alias) @@ -587,7 +589,8 @@ class PluginAwareExtensionManager(ExtensionManager): alias in plugin.supported_extension_aliases) for plugin in self.plugins.values()) if not supports_extension: - LOG.warn(_("Extension %s not supported by any of loaded plugins"), + LOG.warn(_LW("Extension %s not supported by any of loaded " + "plugins"), alias) return supports_extension @@ -598,7 +601,7 @@ class PluginAwareExtensionManager(ExtensionManager): for plugin in self.plugins.values(): if isinstance(plugin, extension.get_plugin_interface()): return True - LOG.warn(_("Loaded plugins do not implement extension %s interface"), + LOG.warn(_LW("Loaded plugins do not implement extension %s interface"), extension.get_alias()) return False diff --git a/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py index a11533707f..ad0077225b 100644 --- a/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py @@ -18,6 +18,7 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.common import utils from neutron import manager +from neutron.openstack.common.gettextutils import _LE, _LW from neutron.openstack.common import log as logging @@ -62,8 +63,8 @@ class DhcpAgentNotifyAPI(n_rpc.RpcProxy): context, 'network_create_end', {'network': {'id': network['id']}}, agent['host']) elif not existing_agents: - LOG.warn(_('Unable to schedule network %s: no agents available; ' - 'will retry on subsequent port creation events.'), + LOG.warn(_LW('Unable to schedule network %s: no agents available; ' + 'will retry on subsequent port creation events.'), network['id']) return new_agents + existing_agents @@ -75,24 +76,24 @@ class DhcpAgentNotifyAPI(n_rpc.RpcProxy): len_enabled_agents = len(enabled_agents) len_active_agents = len(active_agents) if len_active_agents < len_enabled_agents: - LOG.warn(_("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}) + LOG.warn(_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."), + {'active': len_active_agents, + 'total': len_enabled_agents, + 'net_id': network_id}) if not enabled_agents: num_ports = self.plugin.get_ports_count( context, {'network_id': [network_id]}) notification_required = ( num_ports > 0 and len(network['subnets']) >= 1) if notification_required: - 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}) + LOG.error(_LE("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}) return enabled_agents def _is_reserved_dhcp_port(self, port): diff --git a/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py index e22c5292f4..e69ea54c94 100644 --- a/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py @@ -20,6 +20,7 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.common import utils from neutron import manager +from neutron.openstack.common.gettextutils import _LE from neutron.openstack.common import log as logging from neutron.plugins.common import constants as service_constants @@ -37,9 +38,9 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy): def _notification_host(self, context, method, payload, host): """Notify the agent that is hosting the router.""" - LOG.debug(_('Nofity agent at %(host)s the message ' - '%(method)s'), {'host': host, - 'method': method}) + LOG.debug('Nofity agent at %(host)s the message ' + '%(method)s', {'host': host, + 'method': method}) self.cast( context, self.make_msg(method, payload=payload), @@ -59,8 +60,8 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy): if shuffle_agents: random.shuffle(l3_agents) for l3_agent in l3_agents: - LOG.debug(_('Notify agent at %(topic)s.%(host)s the message ' - '%(method)s'), + LOG.debug('Notify agent at %(topic)s.%(host)s the message ' + '%(method)s', {'topic': l3_agent.topic, 'host': l3_agent.host, 'method': method}) @@ -102,8 +103,8 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy): plugin = manager.NeutronManager.get_service_plugins().get( service_constants.L3_ROUTER_NAT) if not plugin: - LOG.error(_('No plugin for L3 routing registered. Cannot notify ' - 'agents with the message %s'), method) + LOG.error(_LE('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): @@ -120,8 +121,8 @@ class L3AgentNotifyAPI(n_rpc.RpcProxy): def _notification_fanout(self, context, method, router_id): """Fanout the deleted router to all L3 agents.""" - LOG.debug(_('Fanout notify agent at %(topic)s the message ' - '%(method)s on router %(router_id)s'), + LOG.debug('Fanout notify agent at %(topic)s the message ' + '%(method)s on router %(router_id)s', {'topic': topics.L3_AGENT, 'method': method, 'router_id': router_id}) diff --git a/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py index 0a37fd7a3e..86fb0c188f 100644 --- a/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py @@ -44,8 +44,8 @@ class MeteringAgentNotifyAPI(n_rpc.RpcProxy): admin_state_up=True, active=True) for l3_agent in l3_agents: - LOG.debug(_('Notify metering agent at %(topic)s.%(host)s ' - 'the message %(method)s'), + LOG.debug('Notify metering agent at %(topic)s.%(host)s ' + 'the message %(method)s', {'topic': self.topic, 'host': l3_agent.host, 'method': method}) @@ -59,8 +59,8 @@ class MeteringAgentNotifyAPI(n_rpc.RpcProxy): topic='%s.%s' % (self.topic, host)) def _notification_fanout(self, context, method, router_id): - LOG.debug(_('Fanout notify metering agent at %(topic)s the message ' - '%(method)s on router %(router_id)s'), + LOG.debug('Fanout notify metering agent at %(topic)s the message ' + '%(method)s on router %(router_id)s', {'topic': self.topic, 'method': method, 'router_id': router_id}) diff --git a/neutron/api/rpc/handlers/dhcp_rpc.py b/neutron/api/rpc/handlers/dhcp_rpc.py index 58317eac4b..a9723476ce 100644 --- a/neutron/api/rpc/handlers/dhcp_rpc.py +++ b/neutron/api/rpc/handlers/dhcp_rpc.py @@ -24,6 +24,7 @@ from neutron.common import utils from neutron.extensions import portbindings from neutron import manager from neutron.openstack.common import excutils +from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging @@ -79,9 +80,9 @@ class DhcpRpcCallback(n_rpc.RpcCallback): else: ctxt.reraise = True net_id = port['port']['network_id'] - LOG.warn(_("Action %(action)s for network %(net_id)s " - "could not complete successfully: %(reason)s") - % {"action": action, "net_id": net_id, 'reason': e}) + LOG.warn(_LW("Action %(action)s for network %(net_id)s " + "could not complete successfully: %(reason)s"), + {"action": action, "net_id": net_id, 'reason': e}) def get_active_networks(self, context, **kwargs): """Retrieve and return a list of the active network ids.""" @@ -89,14 +90,14 @@ class DhcpRpcCallback(n_rpc.RpcCallback): # left so that neutron-dhcp-agents will still continue to work if # neutron-server is upgraded and not the agent. host = kwargs.get('host') - LOG.debug(_('get_active_networks requested from %s'), host) + LOG.debug('get_active_networks requested from %s', host) nets = self._get_active_networks(context, **kwargs) return [net['id'] for net in nets] def get_active_networks_info(self, context, **kwargs): """Returns all the networks/subnets/ports in system.""" host = kwargs.get('host') - LOG.debug(_('get_active_networks_info from %s'), host) + LOG.debug('get_active_networks_info from %s', host) networks = self._get_active_networks(context, **kwargs) plugin = manager.NeutronManager.get_plugin() filters = {'network_id': [network['id'] for network in networks]} @@ -116,15 +117,15 @@ class DhcpRpcCallback(n_rpc.RpcCallback): """Retrieve and return a extended information about a network.""" network_id = kwargs.get('network_id') host = kwargs.get('host') - LOG.debug(_('Network %(network_id)s requested from ' - '%(host)s'), {'network_id': network_id, - 'host': host}) + LOG.debug('Network %(network_id)s requested from ' + '%(host)s', {'network_id': network_id, + 'host': host}) plugin = manager.NeutronManager.get_plugin() try: network = plugin.get_network(context, network_id) except n_exc.NetworkNotFound: - LOG.warn(_("Network %s could not be found, it might have " - "been deleted concurrently."), network_id) + LOG.warn(_LW("Network %s could not be found, it might have " + "been deleted concurrently."), network_id) return filters = dict(network_id=[network_id]) network['subnets'] = plugin.get_subnets(context, filters=filters) @@ -145,10 +146,10 @@ class DhcpRpcCallback(n_rpc.RpcCallback): # There could be more than one dhcp server per network, so create # a device id that combines host and network ids - LOG.debug(_('Port %(device_id)s for %(network_id)s requested from ' - '%(host)s'), {'device_id': device_id, - 'network_id': network_id, - 'host': host}) + LOG.debug('Port %(device_id)s for %(network_id)s requested from ' + '%(host)s', {'device_id': device_id, + 'network_id': network_id, + 'host': host}) plugin = manager.NeutronManager.get_plugin() retval = None @@ -179,16 +180,16 @@ class DhcpRpcCallback(n_rpc.RpcCallback): if retval is None: # No previous port exists, so create a new one. - LOG.debug(_('DHCP port %(device_id)s on network %(network_id)s ' - 'does not exist on %(host)s'), + LOG.debug('DHCP port %(device_id)s on network %(network_id)s ' + 'does not exist on %(host)s', {'device_id': device_id, 'network_id': network_id, 'host': host}) try: network = plugin.get_network(context, network_id) except n_exc.NetworkNotFound: - LOG.warn(_("Network %s could not be found, it might have " - "been deleted concurrently."), network_id) + LOG.warn(_LW("Network %s could not be found, it might have " + "been deleted concurrently."), network_id) return port_dict = dict( @@ -219,8 +220,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback): network_id = kwargs.get('network_id') device_id = kwargs.get('device_id') - LOG.debug(_('DHCP port deletion for %(network_id)s request from ' - '%(host)s'), + LOG.debug('DHCP port deletion for %(network_id)s request from ' + '%(host)s', {'network_id': network_id, 'host': host}) plugin = manager.NeutronManager.get_plugin() plugin.delete_ports_by_device_id(context, device_id, network_id) @@ -232,8 +233,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback): device_id = kwargs.get('device_id') subnet_id = kwargs.get('subnet_id') - LOG.debug(_('DHCP port remove fixed_ip for %(subnet_id)s request ' - 'from %(host)s'), + LOG.debug('DHCP port remove fixed_ip for %(subnet_id)s request ' + 'from %(host)s', {'subnet_id': subnet_id, 'host': host}) plugin = manager.NeutronManager.get_plugin() filters = dict(network_id=[network_id], device_id=[device_id]) @@ -256,8 +257,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback): # neutron-server is upgraded and not the agent. host = kwargs.get('host') - LOG.warning(_('Updating lease expiration is now deprecated. Issued ' - 'from host %s.'), host) + LOG.warning(_LW('Updating lease expiration is now deprecated. Issued ' + 'from host %s.'), host) def create_dhcp_port(self, context, **kwargs): """Create and return dhcp port information. @@ -267,8 +268,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback): """ host = kwargs.get('host') port = kwargs.get('port') - LOG.debug(_('Create dhcp port %(port)s ' - 'from %(host)s.'), + LOG.debug('Create dhcp port %(port)s ' + 'from %(host)s.', {'port': port, 'host': host}) @@ -284,8 +285,8 @@ class DhcpRpcCallback(n_rpc.RpcCallback): host = kwargs.get('host') port = kwargs.get('port') port['id'] = kwargs.get('port_id') - LOG.debug(_('Update dhcp port %(port)s ' - 'from %(host)s.'), + LOG.debug('Update dhcp port %(port)s ' + 'from %(host)s.', {'port': port, 'host': host}) plugin = manager.NeutronManager.get_plugin() diff --git a/neutron/api/rpc/handlers/l3_rpc.py b/neutron/api/rpc/handlers/l3_rpc.py index d4b2b95c2a..53f2ea9c00 100644 --- a/neutron/api/rpc/handlers/l3_rpc.py +++ b/neutron/api/rpc/handlers/l3_rpc.py @@ -24,6 +24,7 @@ from neutron import context as neutron_context from neutron.extensions import l3 from neutron.extensions import portbindings from neutron import manager +from neutron.openstack.common.gettextutils import _LE from neutron.openstack.common import log as logging from neutron.plugins.common import constants as plugin_constants @@ -67,8 +68,8 @@ class L3RpcCallback(n_rpc.RpcCallback): context = neutron_context.get_admin_context() if not self.l3plugin: routers = {} - LOG.error(_('No plugin for L3 routing registered! Will reply ' - 'to l3 agent with empty router dictionary.')) + LOG.error(_LE('No plugin for L3 routing registered! Will reply ' + 'to l3 agent with empty router dictionary.')) elif utils.is_extension_supported( self.l3plugin, constants.L3_AGENT_SCHEDULER_EXT_ALIAS): if cfg.CONF.router_auto_schedule: @@ -81,13 +82,13 @@ class L3RpcCallback(n_rpc.RpcCallback): if utils.is_extension_supported( self.plugin, constants.PORT_BINDING_EXT_ALIAS): self._ensure_host_set_on_ports(context, host, routers) - LOG.debug(_("Routers returned to l3 agent:\n %s"), + LOG.debug("Routers returned to l3 agent:\n %s", jsonutils.dumps(routers, indent=5)) return routers def _ensure_host_set_on_ports(self, context, host, routers): for router in routers: - LOG.debug(_("Checking router: %(id)s for host: %(host)s"), + LOG.debug("Checking router: %(id)s for host: %(host)s", {'id': router['id'], 'host': host}) if router.get('gw_port') and router.get('distributed'): self._ensure_host_set_on_port(context, @@ -147,7 +148,7 @@ class L3RpcCallback(n_rpc.RpcCallback): """ context = neutron_context.get_admin_context() net_id = self.plugin.get_external_network_id(context) - LOG.debug(_("External network ID returned to l3 agent: %s"), + LOG.debug("External network ID returned to l3 agent: %s", net_id) return net_id @@ -159,15 +160,15 @@ class L3RpcCallback(n_rpc.RpcCallback): """Update operational status for a floating IP.""" with context.session.begin(subtransactions=True): for (floatingip_id, status) in fip_statuses.iteritems(): - LOG.debug(_("New status for floating IP %(floatingip_id)s: " - "%(status)s"), {'floatingip_id': floatingip_id, - 'status': status}) + LOG.debug("New status for floating IP %(floatingip_id)s: " + "%(status)s", {'floatingip_id': floatingip_id, + 'status': status}) try: self.l3plugin.update_floatingip_status(context, floatingip_id, status) except l3.FloatingIPNotFound: - LOG.debug(_("Floating IP: %s no longer present."), + LOG.debug("Floating IP: %s no longer present.", floatingip_id) # Find all floating IPs known to have been the given router # for which an update was not received. Set them DOWN mercilessly diff --git a/neutron/api/v2/base.py b/neutron/api/v2/base.py index 80f37d92e9..5af0d81dc4 100644 --- a/neutron/api/v2/base.py +++ b/neutron/api/v2/base.py @@ -27,6 +27,7 @@ from neutron.common import constants as const from neutron.common import exceptions from neutron.common import rpc as n_rpc from neutron.openstack.common import excutils +from neutron.openstack.common.gettextutils import _LE, _LI from neutron.openstack.common import log as logging from neutron.openstack.common import policy as common_policy from neutron import policy @@ -89,8 +90,8 @@ class Controller(object): _("Native pagination depend on native sorting") ) if not self._allow_sorting: - LOG.info(_("Allow sorting is enabled because native " - "pagination requires native sorting")) + LOG.info(_LI("Allow sorting is enabled because native " + "pagination requires native sorting")) self._allow_sorting = True if parent: @@ -360,8 +361,8 @@ class Controller(object): obj_deleter(request.context, obj['id'], **kwargs) except Exception: # broad catch as our only purpose is to log the exception - LOG.exception(_("Unable to undo add for " - "%(resource)s %(id)s"), + LOG.exception(_LE("Unable to undo add for " + "%(resource)s %(id)s"), {'resource': self._resource, 'id': obj['id']}) # TODO(salvatore-orlando): The object being processed when the @@ -581,7 +582,7 @@ class Controller(object): if not body: raise webob.exc.HTTPBadRequest(_("Resource body required")) - LOG.debug(_("Request body: %(body)s"), {'body': body}) + LOG.debug("Request body: %(body)s", {'body': body}) if collection in body: if not allow_bulk: raise webob.exc.HTTPBadRequest(_("Bulk operation " diff --git a/neutron/api/v2/resource.py b/neutron/api/v2/resource.py index 60f1aa718d..286a0c7f55 100644 --- a/neutron/api/v2/resource.py +++ b/neutron/api/v2/resource.py @@ -26,6 +26,7 @@ import webob.exc from neutron.common import exceptions from neutron.openstack.common import gettextutils +from neutron.openstack.common.gettextutils import _LE, _LI from neutron.openstack.common import log as logging from neutron.openstack.common import policy as common_policy from neutron import wsgi @@ -90,10 +91,10 @@ def Resource(controller, faults=None, deserializers=None, serializers=None): else: mapped_exc = webob.exc.HTTPInternalServerError if 400 <= mapped_exc.code < 500: - LOG.info(_('%(action)s failed (client error): %(exc)s'), + LOG.info(_LI('%(action)s failed (client error): %(exc)s'), {'action': action, 'exc': e}) else: - LOG.exception(_('%s failed'), action) + LOG.exception(_LE('%s failed'), action) e = translate(e, language) body = serializer.serialize( {'NeutronError': get_exception_data(e)}) @@ -101,7 +102,7 @@ def Resource(controller, faults=None, deserializers=None, serializers=None): raise mapped_exc(**kwargs) except webob.exc.HTTPException as e: type_, value, tb = sys.exc_info() - LOG.exception(_('%s failed'), action) + LOG.exception(_LE('%s failed'), action) translate(e, language) value.body = serializer.serialize( {'NeutronError': get_exception_data(e)}) @@ -121,7 +122,7 @@ def Resource(controller, faults=None, deserializers=None, serializers=None): raise webob.exc.HTTPNotImplemented(**kwargs) except Exception: # NOTE(jkoelker) Everything else is 500 - LOG.exception(_('%s failed'), action) + LOG.exception(_LE('%s failed'), action) # Do not expose details of 500 error to clients. msg = _('Request Failed: internal server error while ' 'processing your request.') diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index fd780fca78..0dac394786 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -45,6 +45,7 @@ def _directory_to_check_translation(filename): # do it on a directory by directory basis. The last patch of the # series will remove this and the entire code base will be validated. dirs = ["neutron/agent", + "neutron/api", "neutron/cmd", "neutron/db", "neutron/extensions"]