From 9842dcb34cb79b942391fdab4a00dd790b5e299e Mon Sep 17 00:00:00 2001 From: ZhiQiang Fan Date: Tue, 27 Aug 2013 08:02:04 +0800 Subject: [PATCH] Fix message i18n error Partial-Bug: #1217100 Using tools/check_i18n.py to scan source directory, and fix most of the errors. - Message internationalization - First letter must be capital - Using comma instead of percent in LOG.xxx Note: all extension's description are not touched in this patch, can be fixed after discussing. Note: all nicira/check_nvp_config.py print messages are not fixed. Change-Id: I79ef06fd42f6780beb5019c592662536c2a51864 --- neutron/agent/dhcp_agent.py | 2 +- neutron/common/exceptions.py | 2 +- neutron/db/dhcp_rpc_base.py | 2 +- neutron/db/extraroute_db.py | 4 ++-- neutron/db/l3_rpc_base.py | 4 ++-- neutron/debug/commands.py | 2 +- neutron/extensions/providernet.py | 2 +- neutron/plugins/bigswitch/plugin.py | 14 ++++++------ neutron/plugins/bigswitch/routerrule_db.py | 4 ++-- neutron/plugins/brocade/NeutronPlugin.py | 9 +++++--- neutron/plugins/cisco/common/config.py | 10 ++++----- neutron/plugins/cisco/db/n1kv_db_v2.py | 22 +++++++++---------- .../plugins/cisco/models/virt_phy_sw_v2.py | 8 +++---- neutron/plugins/cisco/n1kv/n1kv_client.py | 4 ++-- .../plugins/cisco/n1kv/n1kv_neutron_plugin.py | 12 +++++----- neutron/plugins/cisco/network_plugin.py | 5 +++-- .../cisco/nexus/cisco_nexus_plugin_v2.py | 14 ++++++------ neutron/plugins/embrane/base_plugin.py | 6 ++--- neutron/plugins/embrane/common/config.py | 2 +- .../embrane/l2base/support_exceptions.py | 2 +- .../hyperv/agent/hyperv_neutron_agent.py | 15 +++++++------ neutron/plugins/hyperv/agent/utils.py | 2 +- neutron/plugins/hyperv/agent/utilsfactory.py | 4 ++-- .../agent/linuxbridge_neutron_agent.py | 4 ++-- neutron/plugins/midonet/midonet_lib.py | 3 ++- neutron/plugins/ml2/drivers/cisco/config.py | 2 +- .../drivers/mech_arista/mechanism_arista.py | 11 +++++----- neutron/plugins/ml2/drivers/type_tunnel.py | 2 +- .../mlnx/agent/eswitch_neutron_agent.py | 8 +++---- neutron/plugins/mlnx/common/config.py | 2 +- neutron/plugins/mlnx/db/mlnx_db_v2.py | 2 +- neutron/plugins/mlnx/mlnx_plugin.py | 10 ++++----- neutron/plugins/mlnx/rpc_callbacks.py | 2 +- neutron/plugins/nec/nec_plugin.py | 2 +- neutron/plugins/nec/packet_filter.py | 6 ++--- neutron/plugins/nicira/NeutronPlugin.py | 10 ++++----- neutron/plugins/nicira/common/config.py | 2 +- .../nicira/extensions/nvp_networkgw.py | 6 ++--- neutron/plugins/nicira/nvplib.py | 19 ++++++++-------- neutron/plugins/nicira/vshield/tasks/tasks.py | 5 ++--- neutron/plugins/openvswitch/ovs_db_v2.py | 3 ++- .../plugins/plumgrid/drivers/fake_plumlib.py | 5 +++-- neutron/plugins/plumgrid/drivers/plumlib.py | 2 +- .../plumgrid_plugin/plumgrid_plugin.py | 2 +- .../plugins/ryu/agent/ryu_neutron_agent.py | 2 +- neutron/policy.py | 2 +- neutron/quota.py | 2 +- neutron/service.py | 6 ++--- .../firewall/agents/varmour/varmour_router.py | 4 ++-- .../services/loadbalancer/agent_scheduler.py | 2 +- .../drivers/haproxy/agent_manager.py | 2 +- .../drivers/haproxy/namespace_driver.py | 2 +- .../drivers/haproxy/plugin_driver.py | 2 +- .../metering/agents/metering_agent.py | 4 ++-- .../drivers/iptables/iptables_driver.py | 2 +- neutron/services/vpn/device_drivers/ipsec.py | 4 ++-- neutron/wsgi.py | 2 +- tools/i18n_cfg.py | 2 +- 58 files changed, 153 insertions(+), 144 deletions(-) diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index 251b835c4..b76e0f0f8 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -145,7 +145,7 @@ class DhcpAgent(manager.Manager): except Exception: self.needs_resync = True LOG.exception(_('Unable to sync network state on deleted ' - 'network %s') % deleted_id) + 'network %s'), deleted_id) for network in active_networks: pool.spawn_n(self.configure_dhcp_for_network, network) diff --git a/neutron/common/exceptions.py b/neutron/common/exceptions.py index 5c9f8dd75..cc64089be 100644 --- a/neutron/common/exceptions.py +++ b/neutron/common/exceptions.py @@ -258,7 +258,7 @@ class InvalidExtensionEnv(BadRequest): class InvalidContentType(NeutronException): - message = "Invalid content type %(content_type)s" + message = _("Invalid content type %(content_type)s") class ExternalIpAddressExhausted(BadRequest): diff --git a/neutron/db/dhcp_rpc_base.py b/neutron/db/dhcp_rpc_base.py index ee6c3db1a..a8a2b4bf2 100644 --- a/neutron/db/dhcp_rpc_base.py +++ b/neutron/db/dhcp_rpc_base.py @@ -216,7 +216,7 @@ class DhcpRpcCallbackMixin(object): host = kwargs.get('host') LOG.warning(_('Updating lease expiration is now deprecated. Issued ' - 'from host %(host)s.') % host) + 'from host %s.'), host) def create_dhcp_port(self, context, **kwargs): """Create the dhcp port.""" diff --git a/neutron/db/extraroute_db.py b/neutron/db/extraroute_db.py index 7e8b7b3a7..2a2869889 100644 --- a/neutron/db/extraroute_db.py +++ b/neutron/db/extraroute_db.py @@ -126,7 +126,7 @@ class ExtraRoute_db_mixin(l3_db.L3_NAT_db_mixin): context, router['id']) added, removed = utils.diff_list_of_dict(old_routes, routes) - LOG.debug('Added routes are %s' % added) + LOG.debug(_('Added routes are %s'), added) for route in added: router_routes = RouterRoute( router_id=router['id'], @@ -134,7 +134,7 @@ class ExtraRoute_db_mixin(l3_db.L3_NAT_db_mixin): nexthop=route['nexthop']) context.session.add(router_routes) - LOG.debug('Removed routes are %s' % removed) + LOG.debug(_('Removed routes are %s'), removed) for route in removed: del_context = context.session.query(RouterRoute) del_context.filter_by(router_id=router['id'], diff --git a/neutron/db/l3_rpc_base.py b/neutron/db/l3_rpc_base.py index afd64afe7..24f754bc5 100644 --- a/neutron/db/l3_rpc_base.py +++ b/neutron/db/l3_rpc_base.py @@ -59,8 +59,8 @@ class L3RpcCallbackMixin(object): def _ensure_host_set_on_ports(self, context, plugin, host, routers): for router in routers: - LOG.debug("checking router: %s for host: %s" % - (router['id'], host)) + LOG.debug(_("Checking router: %(id)s for host: %(host)s"), + {'id': router['id'], 'host': host}) self._ensure_host_set_on_port(context, plugin, host, router.get('gw_port')) for interface in router.get(constants.INTERFACE_KEY, []): diff --git a/neutron/debug/commands.py b/neutron/debug/commands.py index d2da9e897..829ed22cc 100644 --- a/neutron/debug/commands.py +++ b/neutron/debug/commands.py @@ -47,7 +47,7 @@ class CreateProbe(ProbeCommand): parser.add_argument( '--device-owner', default='network', choices=['network', 'compute'], - help=_('owner type of the device: network/compute')) + help=_('Owner type of the device: network/compute')) return parser def run(self, parsed_args): diff --git a/neutron/extensions/providernet.py b/neutron/extensions/providernet.py index dab7fa7b8..a51a215b7 100644 --- a/neutron/extensions/providernet.py +++ b/neutron/extensions/providernet.py @@ -53,7 +53,7 @@ def _raise_if_updates_provider_attributes(attrs): """ immutable = (NETWORK_TYPE, PHYSICAL_NETWORK, SEGMENTATION_ID) if any(attributes.is_attr_set(attrs.get(a)) for a in immutable): - msg = _("plugin does not support updating provider attributes") + msg = _("Plugin does not support updating provider attributes") raise q_exc.InvalidInput(error_message=msg) diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index 1588e5deb..2d7746a0d 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -159,7 +159,7 @@ ROUTER_INTF_PATH = "/tenants/%s/routers/%s/interfaces/%s" SUCCESS_CODES = range(200, 207) FAILURE_CODES = [0, 301, 302, 303, 400, 401, 403, 404, 500, 501, 502, 503, 504, 505] -SYNTAX_ERROR_MESSAGE = 'Syntax error in server config file, aborting plugin' +SYNTAX_ERROR_MESSAGE = _('Syntax error in server config file, aborting plugin') BASE_URI = '/networkService/v1.1' ORCHESTRATION_SERVICE_ID = 'Neutron v2.0' METADATA_SERVER_IP = '169.254.169.254' @@ -455,7 +455,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2, timeout = server_timeout # validate config - assert servers is not None, 'Servers not defined. Aborting plugin' + assert servers is not None, _('Servers not defined. Aborting plugin') servers = tuple(s.rsplit(':', 1) for s in servers.split(',')) servers = tuple((server, int(port)) for server, port in servers) assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE @@ -992,7 +992,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2, # we will first get the interface identifier before deleting in the DB if not interface_info: - msg = "Either subnet_id or port_id must be specified" + msg = _("Either subnet_id or port_id must be specified") raise exceptions.BadRequest(resource='router', msg=msg) if 'port_id' in interface_info: port = self._get_port(context, interface_info['port_id']) @@ -1001,7 +1001,7 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2, subnet = self._get_subnet(context, interface_info['subnet_id']) interface_id = subnet['network_id'] else: - msg = "Either subnet_id or port_id must be specified" + msg = _("Either subnet_id or port_id must be specified") raise exceptions.BadRequest(resource='router', msg=msg) with context.session.begin(subtransactions=True): @@ -1144,9 +1144,9 @@ class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2, payload = {'subnet': updated_subnet} self._dhcp_agent_notifier.notify(context, payload, 'subnet.update.end') - LOG.debug("Adding host route: ") - LOG.debug("destination:%s nexthop:%s" % (destination, - nexthop)) + LOG.debug(_("Adding host route: ")) + LOG.debug(_("Destination:%(dst)s nexthop:%(next)s"), + {'dst': destination, 'next': nexthop}) def _get_network_with_floatingips(self, network, context=None): if context is None: diff --git a/neutron/plugins/bigswitch/routerrule_db.py b/neutron/plugins/bigswitch/routerrule_db.py index 1e6b4b933..e947a1f9d 100644 --- a/neutron/plugins/bigswitch/routerrule_db.py +++ b/neutron/plugins/bigswitch/routerrule_db.py @@ -74,7 +74,7 @@ class RouterRule_db_mixin(l3_db.L3_NAT_db_mixin): router_db, r['router_rules']) else: - LOG.debug('No rules in router') + LOG.debug(_('No rules in router')) router_db['router_rules'] = self._get_router_rules_by_router_id( context, router_db['id']) @@ -88,7 +88,7 @@ class RouterRule_db_mixin(l3_db.L3_NAT_db_mixin): del_context = context.session.query(RouterRule) del_context.filter_by(router_id=router['id']).delete() context.session.expunge_all() - LOG.debug('Updating router rules to %s' % rules) + LOG.debug(_('Updating router rules to %s'), rules) for rule in rules: router_rule = RouterRule( router_id=router['id'], diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index 1534a312c..2f0a169b7 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -290,7 +290,8 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, LOG.debug(_("Returning the allocated vlan (%d) to the pool"), vlan_id) self._vlan_bitmap.release_vlan(int(vlan_id)) - raise Exception("Brocade plugin raised exception, check logs") + raise Exception(_("Brocade plugin raised exception, " + "check logs")) brocade_db.create_network(context, net_uuid, vlan_id) self._process_l3_create(context, net, network['network']) @@ -330,7 +331,8 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, # Proper formatting LOG.warning(_("Brocade NOS driver:")) LOG.warning(_("%s"), e) - raise Exception("Brocade plugin raised exception, check logs") + raise Exception(_("Brocade plugin raised exception, " + "check logs")) # now ok to delete the network brocade_db.delete_network(context, net_id) @@ -383,7 +385,8 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2, # Proper formatting LOG.warning(_("Brocade NOS driver:")) LOG.warning(_("%s"), e) - raise Exception("Brocade plugin raised exception, check logs") + raise Exception(_("Brocade plugin raised exception, " + "check logs")) # save to brocade persistent db brocade_db.create_port(context, port_id, network_id, diff --git a/neutron/plugins/cisco/common/config.py b/neutron/plugins/cisco/common/config.py index a7c8953ee..04d05d186 100644 --- a/neutron/plugins/cisco/common/config.py +++ b/neutron/plugins/cisco/common/config.py @@ -36,11 +36,11 @@ cisco_opts = [ cfg.StrOpt('provider_vlan_name_prefix', default='p-', help=_("VLAN Name prefix for provider vlans")), cfg.BoolOpt('provider_vlan_auto_create', default=True, - help='Provider VLANs are automatically created as needed ' - 'on the Nexus switch'), + help=_('Provider VLANs are automatically created as needed ' + 'on the Nexus switch')), cfg.BoolOpt('provider_vlan_auto_trunk', default=True, - help='Provider VLANs are automatically trunked as needed ' - 'on the ports of the Nexus switch'), + help=_('Provider VLANs are automatically trunked as needed ' + 'on the ports of the Nexus switch')), cfg.BoolOpt('svi_round_robin', default=False, help=_("Distribute SVI interfaces over all switches")), cfg.StrOpt('model_class', @@ -121,7 +121,7 @@ class CiscoConfigOptions(): read_ok = multi_parser.read(CONF.config_file) if len(read_ok) != len(CONF.config_file): - raise cfg.Error("Some config files were not parsed properly") + raise cfg.Error(_("Some config files were not parsed properly")) for parsed_file in multi_parser.parsed: for parsed_item in parsed_file.keys(): diff --git a/neutron/plugins/cisco/db/n1kv_db_v2.py b/neutron/plugins/cisco/db/n1kv_db_v2.py index 4167933cc..8fe347de7 100644 --- a/neutron/plugins/cisco/db/n1kv_db_v2.py +++ b/neutron/plugins/cisco/db/n1kv_db_v2.py @@ -667,7 +667,7 @@ def delete_vxlan_allocations(db_session, vxlan_id_ranges): filter_by(allocated=False)) for alloc in allocs: if alloc.vxlan_id in vxlan_ids: - LOG.debug(_("Removing vxlan %s from pool") % + LOG.debug(_("Removing vxlan %s from pool"), alloc.vxlan_id) db_session.delete(alloc) @@ -698,9 +698,9 @@ def reserve_specific_vxlan(db_session, vxlan_id): one()) if alloc.allocated: raise c_exc.VxlanIdInUse(vxlan_id=vxlan_id) - LOG.debug(_("Reserving specific vxlan %s from pool") % vxlan_id) + LOG.debug(_("Reserving specific vxlan %s from pool"), vxlan_id) except exc.NoResultFound: - LOG.debug(_("Reserving specific vxlan %s outside pool") % vxlan_id) + LOG.debug(_("Reserving specific vxlan %s outside pool"), vxlan_id) alloc = n1kv_models_v2.N1kvVxlanAllocation(vxlan_id=vxlan_id) db_session.add(alloc) alloc.allocated = True @@ -946,7 +946,7 @@ def get_policy_profile(db_session, id): def create_profile_binding(tenant_id, profile_id, profile_type): """Create Network/Policy Profile association with a tenant.""" if profile_type not in ["network", "policy"]: - raise q_exc.NeutronException("Invalid profile type") + raise q_exc.NeutronException(_("Invalid profile type")) if _profile_binding_exists(tenant_id, profile_id, profile_type): return get_profile_binding(tenant_id, profile_id) @@ -994,7 +994,7 @@ def delete_profile_binding(tenant_id, profile_id): db_session.delete(binding) except c_exc.ProfileTenantBindingNotFound: LOG.debug(_("Profile-Tenant binding missing for profile ID " - "%(profile_id)s and tenant ID %(tenant_id)s") % + "%(profile_id)s and tenant ID %(tenant_id)s"), {"profile_id": profile_id, "tenant_id": tenant_id}) return @@ -1221,7 +1221,7 @@ class NetworkProfile_db_mixin(object): :param network_profile: network profile object """ if not re.match(r"(\d+)\-(\d+)", network_profile["segment_range"]): - msg = _("invalid segment range. example range: 500-550") + msg = _("Invalid segment range. example range: 500-550") raise q_exc.InvalidInput(error_message=msg) def _validate_network_profile(self, net_p): @@ -1231,7 +1231,7 @@ class NetworkProfile_db_mixin(object): :param net_p: network profile object """ if any(net_p[arg] == "" for arg in ["segment_type"]): - msg = _("arguments segment_type missing" + msg = _("Arguments segment_type missing" " for network profile") LOG.exception(msg) raise q_exc.InvalidInput(error_message=msg) @@ -1246,21 +1246,21 @@ class NetworkProfile_db_mixin(object): raise q_exc.InvalidInput(error_message=msg) if segment_type == c_const.NETWORK_TYPE_VLAN: if "physical_network" not in net_p: - msg = _("argument physical_network missing " + msg = _("Argument physical_network missing " "for network profile") LOG.exception(msg) raise q_exc.InvalidInput(error_message=msg) if segment_type in [c_const.NETWORK_TYPE_TRUNK, c_const.NETWORK_TYPE_OVERLAY]: if "sub_type" not in net_p: - msg = _("argument sub_type missing " + msg = _("Argument sub_type missing " "for network profile") LOG.exception(msg) raise q_exc.InvalidInput(error_message=msg) if segment_type in [c_const.NETWORK_TYPE_VLAN, c_const.NETWORK_TYPE_OVERLAY]: if "segment_range" not in net_p: - msg = _("argument segment_range missing " + msg = _("Argument segment_range missing " "for network profile") LOG.exception(msg) raise q_exc.InvalidInput(error_message=msg) @@ -1306,7 +1306,7 @@ class NetworkProfile_db_mixin(object): (profile_seg_min <= seg_max <= profile_seg_max) or ((seg_min <= profile_seg_min) and (seg_max >= profile_seg_max))): - msg = _("segment range overlaps with another profile") + msg = _("Segment range overlaps with another profile") LOG.exception(msg) raise q_exc.InvalidInput(error_message=msg) diff --git a/neutron/plugins/cisco/models/virt_phy_sw_v2.py b/neutron/plugins/cisco/models/virt_phy_sw_v2.py index 4b42a095f..2f58f7566 100644 --- a/neutron/plugins/cisco/models/virt_phy_sw_v2.py +++ b/neutron/plugins/cisco/models/virt_phy_sw_v2.py @@ -233,9 +233,9 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2): cdb.add_provider_network(network_id, const.NETWORK_TYPE_VLAN, provider_vlan_id) - LOG.debug(_("provider network added to DB: %(network_id)s, " - "%(vlan_id)s"), {'network_id': network_id, - 'vlan_id': provider_vlan_id}) + LOG.debug(_("Provider network added to DB: %(network_id)s, " + "%(vlan_id)s"), + {'network_id': network_id, 'vlan_id': provider_vlan_id}) return ovs_output[0] def update_network(self, context, id, network): @@ -277,7 +277,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2): self._func_name(), args) if cdb.remove_provider_network(id): - LOG.debug(_("provider network removed from DB: %s"), id) + LOG.debug(_("Provider network removed from DB: %s"), id) return ovs_output[0] def get_network(self, context, id, fields=None): diff --git a/neutron/plugins/cisco/n1kv/n1kv_client.py b/neutron/plugins/cisco/n1kv/n1kv_client.py index 69e9c4f78..1334b161a 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_client.py +++ b/neutron/plugins/cisco/n1kv/n1kv_client.py @@ -253,7 +253,7 @@ class Client(object): :param network_profile: network profile dict """ - LOG.debug(_("logical network")) + LOG.debug(_("Logical network")) body = {'name': network_profile['name']} return self._post(self.logical_networks_path, body=body) @@ -459,7 +459,7 @@ class Client(object): elif type(data) is dict: return wsgi.Serializer().serialize(data, self._set_content_type()) else: - raise Exception("unable to serialize object of type = '%s'" % + raise Exception(_("Unable to serialize object of type = '%s'") % type(data)) def _deserialize(self, data, status_code): diff --git a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py index ed00c50c5..fe0693bfc 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py +++ b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py @@ -350,7 +350,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, if network_type == c_const.NETWORK_TYPE_VLAN: if physical_network_set: if physical_network not in self.network_vlan_ranges: - msg = (_("unknown provider:physical_network %s"), + msg = (_("Unknown provider:physical_network %s") % physical_network) raise q_exc.InvalidInput(error_message=msg) elif 'default' in self.network_vlan_ranges: @@ -376,7 +376,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, return # TBD : Need to handle provider network updates - msg = _("plugin does not support updating provider attributes") + msg = _("Plugin does not support updating provider attributes") raise q_exc.InvalidInput(error_message=msg) def _get_cluster(self, segment1, segment2, clusters): @@ -992,7 +992,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, self._add_dummy_profile_only_if_testing(network) profile_id = self._process_network_profile(context, network['network']) segment_pairs = None - LOG.debug(_('create network: profile_id=%s'), profile_id) + LOG.debug(_('Create network: profile_id=%s'), profile_id) session = context.session with session.begin(subtransactions=True): if not network_type: @@ -1012,7 +1012,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, segment_pairs = ( self._parse_multi_segments(context, network['network'], n1kv_profile.SEGMENT_ADD)) - LOG.debug(_('seg list %s '), segment_pairs) + LOG.debug(_('Seg list %s '), segment_pairs) elif network_type == c_const.NETWORK_TYPE_TRUNK: network_profile = self.get_network_profile(context, profile_id) @@ -1022,7 +1022,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, physical_network, network_profile['sub_type'] )) - LOG.debug(_('seg list %s '), segment_pairs) + LOG.debug(_('Seg list %s '), segment_pairs) else: if not segmentation_id: raise q_exc.TenantNetworksDisabled() @@ -1238,7 +1238,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2, if profile_id_set: profile_id = self._process_policy_profile(context, port['port']) - LOG.debug(_('create port: profile_id=%s'), profile_id) + LOG.debug(_('Create port: profile_id=%s'), profile_id) session = context.session with session.begin(subtransactions=True): pt = super(N1kvNeutronPluginV2, self).create_port(context, diff --git a/neutron/plugins/cisco/network_plugin.py b/neutron/plugins/cisco/network_plugin.py index c0ef874eb..f64822f51 100644 --- a/neutron/plugins/cisco/network_plugin.py +++ b/neutron/plugins/cisco/network_plugin.py @@ -113,8 +113,9 @@ class PluginV2(db_base_plugin_v2.NeutronDbPluginV2): else: # Must make sure we re-raise the error that led us here, since # otherwise getattr() and even hasattr() doesn't work corretly. - raise AttributeError("'%s' object has no attribute '%s'" % - (self._model, name)) + raise AttributeError( + _("'%(model)s' object has no attribute '%(name)s'") % + {'model': self._model, 'name': name}) def _extend_fault_map(self): """Extend the Neutron Fault Map for Cisco exceptions. diff --git a/neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py b/neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py index 4f700b46c..548ba260b 100644 --- a/neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py +++ b/neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py @@ -109,19 +109,19 @@ class NexusPlugin(L2DevicePluginBase): except cisco_exc.NexusPortBindingNotFound: if auto_create and auto_trunk: # Create vlan and trunk vlan on the port - LOG.debug("Nexus: create & trunk vlan %s" % vlan_name) + LOG.debug(_("Nexus: create & trunk vlan %s"), vlan_name) self._client.create_and_trunk_vlan( switch_ip, vlan_id, vlan_name, etype, port_id) vlan_created = True vlan_trunked = True elif auto_create: # Create vlan but do not trunk it on the port - LOG.debug("Nexus: create vlan %s" % vlan_name) + LOG.debug(_("Nexus: create vlan %s"), vlan_name) self._client.create_vlan(switch_ip, vlan_id, vlan_name) vlan_created = True elif auto_trunk: # Only trunk vlan on the port - LOG.debug("Nexus: trunk vlan %s" % vlan_name) + LOG.debug(_("Nexus: trunk vlan %s"), vlan_name) self._client.enable_vlan_on_trunk_int( switch_ip, vlan_id, etype, port_id) vlan_trunked = True @@ -134,16 +134,16 @@ class NexusPlugin(L2DevicePluginBase): with excutils.save_and_reraise_exception(): # Add binding failed, roll back any vlan creation/enabling if vlan_created and vlan_trunked: - LOG.debug("Nexus: delete & untrunk vlan %s" % + LOG.debug(_("Nexus: delete & untrunk vlan %s"), vlan_name) self._client.delete_and_untrunk_vlan(switch_ip, vlan_id, etype, port_id) elif vlan_created: - LOG.debug("Nexus: delete vlan %s" % vlan_name) + LOG.debug(_("Nexus: delete vlan %s"), vlan_name) self._client.delete_vlan(switch_ip, vlan_id) elif vlan_trunked: - LOG.debug("Nexus: untrunk vlan %s" % vlan_name) + LOG.debug(_("Nexus: untrunk vlan %s"), vlan_name) self._client.disable_vlan_on_trunk_int(switch_ip, vlan_id, etype, @@ -273,7 +273,7 @@ class NexusPlugin(L2DevicePluginBase): if cdb.is_provider_vlan(vlan_id): auto_delete = conf.CISCO.provider_vlan_auto_create auto_untrunk = conf.CISCO.provider_vlan_auto_trunk - LOG.debug("delete_network(): provider vlan %s" % vlan_id) + LOG.debug(_("delete_network(): provider vlan %s"), vlan_id) instance_id = False for row in rows: diff --git a/neutron/plugins/embrane/base_plugin.py b/neutron/plugins/embrane/base_plugin.py index 2aa981f01..2db95e877 100644 --- a/neutron/plugins/embrane/base_plugin.py +++ b/neutron/plugins/embrane/base_plugin.py @@ -133,7 +133,7 @@ class EmbranePlugin(object): "device_owner": ["network:router_gateway"]}) if len(gw_ports) != 1: raise c_exc.EmbranePluginException( - err_msg=_("there must be only one gateway port " + err_msg=_("There must be only one gateway port " "per router at once")) gw_port = gw_ports[0] @@ -170,8 +170,8 @@ class EmbranePlugin(object): "device_owner": ["network:router_gateway"]}) if len(gw_ports) != 1: raise c_exc.EmbranePluginException( - err_msg=_("there must be only one gateway port" - " per router at once")) + err_msg=_("There must be only one gateway port " + "per router at once")) gw_port = gw_ports[0] utif_info = (self._plugin_support.retrieve_utif_info(context, diff --git a/neutron/plugins/embrane/common/config.py b/neutron/plugins/embrane/common/config.py index bbf825b9b..b376056fc 100644 --- a/neutron/plugins/embrane/common/config.py +++ b/neutron/plugins/embrane/common/config.py @@ -42,7 +42,7 @@ heleos_opts = [ cfg.StrOpt('resource_pool_id', default='default', help=_('Shared resource pool id')), cfg.BoolOpt('async_requests', default=True, - help=_('define if the requests have ' + help=_('Define if the requests have ' 'run asynchronously or not')), ] diff --git a/neutron/plugins/embrane/l2base/support_exceptions.py b/neutron/plugins/embrane/l2base/support_exceptions.py index 3af17e311..1c5c01322 100644 --- a/neutron/plugins/embrane/l2base/support_exceptions.py +++ b/neutron/plugins/embrane/l2base/support_exceptions.py @@ -21,5 +21,5 @@ from neutron.plugins.embrane.common import exceptions as embrane_exc class UtifInfoError(embrane_exc.EmbranePluginException): - message = _("cannot retrieve utif info for the following reason: " + message = _("Cannot retrieve utif info for the following reason: " "%(err_msg)s") diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index d5befb11c..b86aa5135 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -258,22 +258,23 @@ class HyperVNeutronAgent(object): def _treat_devices_added(self, devices): resync = False for device in devices: - LOG.info(_("Adding port %s") % device) + LOG.info(_("Adding port %s"), device) try: device_details = self.plugin_rpc.get_device_details( self.context, device, self.agent_id) except Exception as e: - LOG.debug(_( - "Unable to get port details for device %(device)s: %(e)s"), - dict(device=device, e=e)) + LOG.debug( + _("Unable to get port details for " + "device %(device)s: %(e)s"), + {'device': device, 'e': e}) resync = True continue if 'port_id' in device_details: - LOG.info(_( - "Port %(device)s updated. Details: %(device_details)s") % - dict(device=device, device_details=device_details)) + LOG.info( + _("Port %(device)s updated. Details: %(device_details)s"), + {'device': device, 'device_details': device_details}) self._treat_vif_port( device_details['port_id'], device_details['network_id'], diff --git a/neutron/plugins/hyperv/agent/utils.py b/neutron/plugins/hyperv/agent/utils.py index 2b6d56f66..3e26caef4 100644 --- a/neutron/plugins/hyperv/agent/utils.py +++ b/neutron/plugins/hyperv/agent/utils.py @@ -152,7 +152,7 @@ class HyperVUtils(object): desc = job.Description elap = job.ElapsedTime - LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s") % + LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s"), {'desc': desc, 'elap': elap}) def _create_switch_port(self, vswitch_name, switch_port_name): diff --git a/neutron/plugins/hyperv/agent/utilsfactory.py b/neutron/plugins/hyperv/agent/utilsfactory.py index cd1c13134..8d594a223 100644 --- a/neutron/plugins/hyperv/agent/utilsfactory.py +++ b/neutron/plugins/hyperv/agent/utilsfactory.py @@ -31,7 +31,7 @@ if sys.platform == 'win32': hyper_opts = [ cfg.BoolOpt('force_hyperv_utils_v1', default=False, - help='Force V1 WMI utility classes'), + help=_('Force V1 WMI utility classes')), ] CONF = cfg.CONF @@ -56,7 +56,7 @@ def _get_class(v1_class, v2_class, force_v1_flag): cls = v2_class else: cls = v1_class - LOG.debug("Loading class: %(module_name)s.%(class_name)s", + LOG.debug(_("Loading class: %(module_name)s.%(class_name)s"), {'module_name': cls.__module__, 'class_name': cls.__name__}) return cls diff --git a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py index b9e4d42c1..79c0f92f5 100755 --- a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -512,7 +512,7 @@ class LinuxBridgeNeutronAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin): self.agent_state) self.agent_state.pop('start_flag', None) except Exception: - LOG.exception("Failed reporting state!") + LOG.exception(_("Failed reporting state!")) def setup_rpc(self, physical_interfaces): if physical_interfaces: @@ -523,7 +523,7 @@ class LinuxBridgeNeutronAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin): mac = utils.get_interface_mac(devices[0].name) else: LOG.error(_("Unable to obtain MAC address for unique ID. " - "Agent terminated!")) + "Agent terminated!")) exit(1) self.agent_id = '%s%s' % ('lb', (mac.replace(":", ""))) LOG.info(_("RPC agent_id: %s"), self.agent_id) diff --git a/neutron/plugins/midonet/midonet_lib.py b/neutron/plugins/midonet/midonet_lib.py index e5f74dabb..ef6dec7a3 100644 --- a/neutron/plugins/midonet/midonet_lib.py +++ b/neutron/plugins/midonet/midonet_lib.py @@ -192,7 +192,8 @@ class MidoClient: {'bridge': bridge}) dhcp = bridge.get_dhcp_subnets() if not dhcp: - raise MidonetApiException(msg="Tried to delete non-existent DHCP") + raise MidonetApiException( + msg=_("Tried to delete non-existent DHCP")) dhcp[0].delete() @handle_api_error diff --git a/neutron/plugins/ml2/drivers/cisco/config.py b/neutron/plugins/ml2/drivers/cisco/config.py index cf47dc443..c1d7ac1d3 100644 --- a/neutron/plugins/ml2/drivers/cisco/config.py +++ b/neutron/plugins/ml2/drivers/cisco/config.py @@ -53,7 +53,7 @@ class ML2MechCiscoConfig(object): read_ok = multi_parser.read(cfg.CONF.config_file) if len(read_ok) != len(cfg.CONF.config_file): - raise cfg.Error("Some config files were not parsed properly") + raise cfg.Error(_("Some config files were not parsed properly")) for parsed_file in multi_parser.parsed: for parsed_item in parsed_file.keys(): diff --git a/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py b/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py index c72358b63..f8f2cbbab 100644 --- a/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py +++ b/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py @@ -27,7 +27,7 @@ from neutron.plugins.ml2.drivers.mech_arista import exceptions as arista_exc LOG = logging.getLogger(__name__) -EOS_UNREACHABLE_MSG = 'Unable to reach EOS' +EOS_UNREACHABLE_MSG = _('Unable to reach EOS') class AristaRPCWrapper(object): @@ -235,9 +235,10 @@ class AristaRPCWrapper(object): ret = ret[len(command_start):-len(command_end)] except Exception as error: host = cfg.CONF.ml2_arista.eapi_host - msg = ('Error %s while trying to execute commands %s on EOS %s' % - (error, full_command, host)) - LOG.exception(_("%s"), msg) + msg = (_('Error %(err)s while trying to execute ' + 'commands %(cmd)s on EOS %(host)s') % + {'err': error, 'cmd': full_command, 'host': host}) + LOG.exception(msg) raise arista_exc.AristaRpcError(msg=msg) return ret @@ -275,7 +276,7 @@ class SyncService(object): def synchronize(self): """Sends data to EOS which differs from neutron DB.""" - LOG.info('Syncing Neutron <-> EOS') + LOG.info(_('Syncing Neutron <-> EOS')) try: eos_tenants = self._rpc.get_tenants() except arista_exc.AristaRpcError: diff --git a/neutron/plugins/ml2/drivers/type_tunnel.py b/neutron/plugins/ml2/drivers/type_tunnel.py index 341a023f2..a761bf26b 100644 --- a/neutron/plugins/ml2/drivers/type_tunnel.py +++ b/neutron/plugins/ml2/drivers/type_tunnel.py @@ -100,7 +100,7 @@ class TunnelRpcCallbackMixin(object): tunnel_ip = kwargs.get('tunnel_ip') tunnel_type = kwargs.get('tunnel_type') if not tunnel_type: - msg = "network_type value needed by the ML2 plugin" + msg = _("Network_type value needed by the ML2 plugin") raise exc.InvalidInput(error_message=msg) driver = self.type_manager.drivers.get(tunnel_type) if driver: diff --git a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py index e05fac15b..c82dd9f83 100644 --- a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py +++ b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py @@ -130,9 +130,9 @@ class EswitchManager(object): physical_network, segmentation_id): LOG.info(_("Provisioning network %s"), network_id) if network_type == constants.TYPE_VLAN: - LOG.debug(_("creating VLAN Network")) + LOG.debug(_("Creating VLAN Network")) elif network_type == constants.TYPE_IB: - LOG.debug(_("creating IB Network")) + LOG.debug(_("Creating IB Network")) else: LOG.error(_("Unknown network type %(network_type)s " "for network %(network_id)s"), @@ -295,10 +295,10 @@ class MlnxEswitchNeutronAgent(sg_rpc.SecurityGroupAgentRpcMixin): resync_a = False resync_b = False if port_info.get('added'): - LOG.debug(_("ports added!")) + LOG.debug(_("Ports added!")) resync_a = self.treat_devices_added(port_info['added']) if port_info.get('removed'): - LOG.debug(_("ports removed!")) + LOG.debug(_("Ports removed!")) resync_b = self.treat_devices_removed(port_info['removed']) # If one of the above opertaions fails => resync with plugin return (resync_a | resync_b) diff --git a/neutron/plugins/mlnx/common/config.py b/neutron/plugins/mlnx/common/config.py index 490d92352..837506749 100644 --- a/neutron/plugins/mlnx/common/config.py +++ b/neutron/plugins/mlnx/common/config.py @@ -40,7 +40,7 @@ eswitch_opts = [ help=_("List of :")), cfg.StrOpt('vnic_type', default=constants.VIF_TYPE_DIRECT, - help=_("type of VM network interface: mlnx_direct or " + help=_("Type of VM network interface: mlnx_direct or " "hostdev")), cfg.StrOpt('daemon_endpoint', default='tcp://127.0.0.1:5001', diff --git a/neutron/plugins/mlnx/db/mlnx_db_v2.py b/neutron/plugins/mlnx/db/mlnx_db_v2.py index 701f5b27f..f730824ed 100644 --- a/neutron/plugins/mlnx/db/mlnx_db_v2.py +++ b/neutron/plugins/mlnx/db/mlnx_db_v2.py @@ -65,7 +65,7 @@ def _remove_unconfigured_vlans(session, allocations): for entries in allocations.itervalues(): for entry in entries: if not entry.allocated: - LOG.debug(_("removing vlan %(seg_id)s on physical " + LOG.debug(_("Removing vlan %(seg_id)s on physical " "network %(net)s from pool"), {'seg_id': entry.segmentation_id, 'net': entry.physical_network}) diff --git a/neutron/plugins/mlnx/mlnx_plugin.py b/neutron/plugins/mlnx/mlnx_plugin.py index 87243a9cc..7c5d550cd 100644 --- a/neutron/plugins/mlnx/mlnx_plugin.py +++ b/neutron/plugins/mlnx/mlnx_plugin.py @@ -240,7 +240,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2, constants.TYPE_FLAT]: if physical_network_set: if physical_network not in self.network_vlan_ranges: - msg = _("unknown provider:physical_network " + msg = _("Unknown provider:physical_network " "%s") % physical_network raise q_exc.InvalidInput(error_message=msg) elif 'default' in self.network_vlan_ranges: @@ -277,11 +277,11 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2, self.base_binding_dict[portbindings.VIF_TYPE] = vnic_type return vnic_type else: - msg = (_("unsupported vnic type %(vnic_type)s " + msg = (_("Unsupported vnic type %(vnic_type)s " "for network type %(net_type)s") % {'vnic_type': vnic_type, 'net_type': net_type}) else: - msg = _("invalid vnic_type on port_create") + msg = _("Invalid vnic_type on port_create") else: msg = _("vnic_type is not defined in port profile") raise q_exc.InvalidInput(error_message=msg) @@ -328,7 +328,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2, return net def update_network(self, context, net_id, network): - LOG.debug(_("update network")) + LOG.debug(_("Update network")) provider._raise_if_updates_provider_attributes(network['network']) session = context.session @@ -341,7 +341,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2, return net def delete_network(self, context, net_id): - LOG.debug(_("delete network")) + LOG.debug(_("Delete network")) session = context.session with session.begin(subtransactions=True): binding = db.get_network_binding(session, net_id) diff --git a/neutron/plugins/mlnx/rpc_callbacks.py b/neutron/plugins/mlnx/rpc_callbacks.py index 36e54fd70..6b9633635 100644 --- a/neutron/plugins/mlnx/rpc_callbacks.py +++ b/neutron/plugins/mlnx/rpc_callbacks.py @@ -95,7 +95,7 @@ class MlnxRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin, db.set_port_status(port['id'], new_status) else: entry = {'device': device} - LOG.debug("%s can not be found in database", device) + LOG.debug(_("%s can not be found in database"), device) return entry def update_device_down(self, rpc_context, **kwargs): diff --git a/neutron/plugins/nec/nec_plugin.py b/neutron/plugins/nec/nec_plugin.py index 158d42ea9..bbca6b47c 100644 --- a/neutron/plugins/nec/nec_plugin.py +++ b/neutron/plugins/nec/nec_plugin.py @@ -273,7 +273,7 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2, self.ofc.create_ofc_tenant(context, tenant_id) self.ofc.create_ofc_network(context, tenant_id, net_id, net_name) except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc: - LOG.error(_("failed to create network id=%(id)s on " + LOG.error(_("Failed to create network id=%(id)s on " "OFC: %(exc)s"), {'id': net_id, 'exc': exc}) network['network']['status'] = const.NET_STATUS_ERROR diff --git a/neutron/plugins/nec/packet_filter.py b/neutron/plugins/nec/packet_filter.py index b11e1e475..8c30bd420 100644 --- a/neutron/plugins/nec/packet_filter.py +++ b/neutron/plugins/nec/packet_filter.py @@ -89,7 +89,7 @@ class PacketFilterMixin(pf_db.PacketFilterDbMixin): pf = self.deactivate_packet_filter(context, pf) if pf['status'] == pf_db.PF_STATUS_ERROR: - msg = _("failed to delete packet_filter id=%s which remains in " + msg = _("Failed to delete packet_filter id=%s which remains in " "error status.") % id LOG.error(msg) raise nexc.OFCException(reason=msg) @@ -128,7 +128,7 @@ class PacketFilterMixin(pf_db.PacketFilterDbMixin): packet_filter) pf_status = pf_db.PF_STATUS_ACTIVE except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc: - LOG.error(_("failed to create packet_filter id=%(id)s on " + LOG.error(_("Failed to create packet_filter id=%(id)s on " "OFC: %(exc)s"), {'id': pf_id, 'exc': str(exc)}) pf_status = pf_db.PF_STATUS_ERROR @@ -154,7 +154,7 @@ class PacketFilterMixin(pf_db.PacketFilterDbMixin): self.ofc.delete_ofc_packet_filter(context, pf_id) pf_status = pf_db.PF_STATUS_DOWN except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc: - LOG.error(_("failed to delete packet_filter id=%(id)s from " + LOG.error(_("Failed to delete packet_filter id=%(id)s from " "OFC: %(exc)s"), {'id': pf_id, 'exc': str(exc)}) pf_status = pf_db.PF_STATUS_ERROR else: diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index af4a6ff4f..3f74ac1d3 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -511,7 +511,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin, 'net_id': port_data['network_id']}) except q_exc.NotFound: - LOG.warning(_("port %s not found in NVP"), port_data['id']) + LOG.warning(_("Port %s not found in NVP"), port_data['id']) def _nvp_delete_router_port(self, context, port_data): # Delete logical router port @@ -1438,9 +1438,9 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin, "L3GatewayAttachment", self.cluster.default_l3_gw_service_uuid) except nvp_exc.NvpPluginException: - LOG.exception(_("Unable to create L3GW port on logical router " + LOG.exception(_("Unable to create L3GW port on logical router " "%(router_uuid)s. Verify Default Layer-3 Gateway " - "service %(def_l3_gw_svc)s id is correct") % + "service %(def_l3_gw_svc)s id is correct"), {'router_uuid': lrouter['uuid'], 'def_l3_gw_svc': self.cluster.default_l3_gw_service_uuid}) @@ -1546,10 +1546,10 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin, nvplib.delete_lrouter(self.cluster, router_id) except q_exc.NotFound: LOG.warning(_("Logical router '%s' not found " - "on NVP Platform") % router_id) + "on NVP Platform"), router_id) except NvpApiClient.NvpApiException: raise nvp_exc.NvpPluginException( - err_msg=(_("Unable to delete logical router '%s'" + err_msg=(_("Unable to delete logical router '%s' " "on NVP Platform") % router_id)) def add_router_interface(self, context, router_id, interface_info): diff --git a/neutron/plugins/nicira/common/config.py b/neutron/plugins/nicira/common/config.py index 721294e59..05e885723 100644 --- a/neutron/plugins/nicira/common/config.py +++ b/neutron/plugins/nicira/common/config.py @@ -175,7 +175,7 @@ def register_deprecated(conf): multi_parser = cfg.MultiConfigParser() read_ok = multi_parser.read(conf.config_file) if len(read_ok) != len(conf.config_file): - raise cfg.Error("Some config files were not parsed properly") + raise cfg.Error(_("Some config files were not parsed properly")) for parsed_file in multi_parser.parsed: for section in parsed_file.keys(): diff --git a/neutron/plugins/nicira/extensions/nvp_networkgw.py b/neutron/plugins/nicira/extensions/nvp_networkgw.py index cd9e45fd0..58558153d 100644 --- a/neutron/plugins/nicira/extensions/nvp_networkgw.py +++ b/neutron/plugins/nicira/extensions/nvp_networkgw.py @@ -79,8 +79,8 @@ def _validate_device_list(data, valid_values=None): return err_msg unexpected_keys = [key for key in device if key not in key_specs] if unexpected_keys: - err_msg = ("Unexpected keys found in device description:%s", - ",".join(unexpected_keys)) + err_msg = (_("Unexpected keys found in device description:%s") + % ",".join(unexpected_keys)) return err_msg except TypeError: return (_("%s: provided data are not iterable") % @@ -89,7 +89,7 @@ def _validate_device_list(data, valid_values=None): nw_gw_quota_opts = [ cfg.IntOpt('quota_network_gateway', default=5, - help=_('number of network gateways allowed per tenant, ' + help=_('Number of network gateways allowed per tenant, ' '-1 for unlimited')) ] diff --git a/neutron/plugins/nicira/nvplib.py b/neutron/plugins/nicira/nvplib.py index a65dfc08a..cb5975dbf 100644 --- a/neutron/plugins/nicira/nvplib.py +++ b/neutron/plugins/nicira/nvplib.py @@ -530,9 +530,9 @@ def update_explicit_routes_lrouter(cluster, router_id, routes): router_id, route) added_routes.append(uuid) except NvpApiClient.NvpApiException: - LOG.exception(_('Cannot update NVP routes %(routes)s for' - ' router %(router_id)s') % {'routes': routes, - 'router_id': router_id}) + LOG.exception(_('Cannot update NVP routes %(routes)s for ' + 'router %(router_id)s'), + {'routes': routes, 'router_id': router_id}) # Roll back to keep NVP in consistent state with excutils.save_and_reraise_exception(): if nvp_routes: @@ -665,7 +665,7 @@ def get_port_by_neutron_tag(cluster, lswitch_uuid, neutron_port_id): filters={'tag': neutron_port_id, 'tag_scope': 'q_port_id'}) LOG.debug(_("Looking for port with q_port_id tag '%(neutron_port_id)s' " - "on: '%(lswitch_uuid)s'") % + "on: '%(lswitch_uuid)s'"), {'neutron_port_id': neutron_port_id, 'lswitch_uuid': lswitch_uuid}) res = do_request(HTTP_GET, uri, cluster=cluster) @@ -674,7 +674,7 @@ def get_port_by_neutron_tag(cluster, lswitch_uuid, neutron_port_id): if num_results > 1: LOG.warn(_("Found '%(num_ports)d' ports with " "q_port_id tag: '%(neutron_port_id)s'. " - "Only 1 was expected.") % + "Only 1 was expected."), {'num_ports': num_results, 'neutron_port_id': neutron_port_id}) return res["results"][0] @@ -963,10 +963,11 @@ def format_exception(etype, e, exception_locals): :param execption_locals: calling context local variable dict. :returns: a formatted string. """ - msg = ["Error. %s exception: %s." % (etype, e)] + msg = [_("Error. %(type)s exception: %(exc)s.") % + {'type': etype, 'exc': e}] l = dict((k, v) for k, v in exception_locals.iteritems() if k != 'request') - msg.append("locals=[%s]" % str(l)) + msg.append(_("locals=[%s]") % str(l)) return ' '.join(msg) @@ -1326,8 +1327,8 @@ def config_helper(http_method, http_uri, cluster): http_uri, cluster=cluster) except Exception as e: - msg = ("Error '%s' when connecting to controller(s): %s." - % (str(e), ', '.join(cluster.nvp_controllers))) + msg = (_("Error '%(err)s' when connecting to controller(s): %(ctl)s.") + % {'err': str(e), 'ctl': ', '.join(cluster.nvp_controllers)}) raise Exception(msg) diff --git a/neutron/plugins/nicira/vshield/tasks/tasks.py b/neutron/plugins/nicira/vshield/tasks/tasks.py index 2128b3cbd..a2c280907 100755 --- a/neutron/plugins/nicira/vshield/tasks/tasks.py +++ b/neutron/plugins/nicira/vshield/tasks/tasks.py @@ -211,9 +211,8 @@ class TaskManager(): 'cb': str(task._result_callback)} LOG.exception(msg) - LOG.debug(_("Task %(task)s return %(status)s") % { - 'task': str(task), - 'status': task.status}) + LOG.debug(_("Task %(task)s return %(status)s"), + {'task': str(task), 'status': task.status}) task._finished() diff --git a/neutron/plugins/openvswitch/ovs_db_v2.py b/neutron/plugins/openvswitch/ovs_db_v2.py index 4eb9015e2..3c52481b7 100644 --- a/neutron/plugins/openvswitch/ovs_db_v2.py +++ b/neutron/plugins/openvswitch/ovs_db_v2.py @@ -397,4 +397,5 @@ def add_tunnel_endpoint(ip, max_retries=10): 'transaction had been commited (%s attempts left)'), max_retries - (i + 1)) - raise q_exc.NeutronException(message='Unable to generate a new tunnel id') + raise q_exc.NeutronException( + message=_('Unable to generate a new tunnel id')) diff --git a/neutron/plugins/plumgrid/drivers/fake_plumlib.py b/neutron/plugins/plumgrid/drivers/fake_plumlib.py index 8b94341b4..28f32977c 100644 --- a/neutron/plugins/plumgrid/drivers/fake_plumlib.py +++ b/neutron/plugins/plumgrid/drivers/fake_plumlib.py @@ -29,12 +29,13 @@ class Plumlib(): """ def __init__(self): - LOG.info('Python PLUMgrid Fake Library Started ') + LOG.info(_('Python PLUMgrid Fake Library Started ')) pass def director_conn(self, director_plumgrid, director_port, timeout, director_admin, director_password): - LOG.info('Fake Director: %s', director_plumgrid + ':' + director_port) + LOG.info(_('Fake Director: %s'), + director_plumgrid + ':' + director_port) pass def create_network(self, tenant_id, net_db): diff --git a/neutron/plugins/plumgrid/drivers/plumlib.py b/neutron/plugins/plumgrid/drivers/plumlib.py index 9f66c4a48..4c71f80ca 100644 --- a/neutron/plugins/plumgrid/drivers/plumlib.py +++ b/neutron/plugins/plumgrid/drivers/plumlib.py @@ -35,7 +35,7 @@ class Plumlib(object): """ def __init__(self): - LOG.info('Python PLUMgrid Library Started ') + LOG.info(_('Python PLUMgrid Library Started ')) def director_conn(self, director_plumgrid, director_port, timeout, director_admin, director_password): diff --git a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py index 5e6aaf5ed..2d4833363 100644 --- a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py +++ b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py @@ -37,7 +37,7 @@ from neutron.plugins.plumgrid.plumgrid_plugin.plugin_ver import VERSION LOG = logging.getLogger(__name__) PLUM_DRIVER = 'neutron.plugins.plumgrid.drivers.plumlib.Plumlib' -ERR_MESSAGE = 'PLUMgrid Director communication failed' +ERR_MESSAGE = _('PLUMgrid Director communication failed') director_server_opts = [ cfg.StrOpt('director_server', default='localhost', diff --git a/neutron/plugins/ryu/agent/ryu_neutron_agent.py b/neutron/plugins/ryu/agent/ryu_neutron_agent.py index 7534a5b92..dddbe15cb 100755 --- a/neutron/plugins/ryu/agent/ryu_neutron_agent.py +++ b/neutron/plugins/ryu/agent/ryu_neutron_agent.py @@ -235,7 +235,7 @@ class OVSNeutronOFPRyuAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin): 'tcp:%s:%d' % (ovsdb_ip, ovsdb_port)) def port_update(self, context, **kwargs): - LOG.debug(_("port update received")) + LOG.debug(_("Port update received")) port = kwargs.get('port') vif_port = self.int_br.get_vif_port_by_id(port['id']) if not vif_port: diff --git a/neutron/policy.py b/neutron/policy.py index 2d25a8d77..a129813a2 100644 --- a/neutron/policy.py +++ b/neutron/policy.py @@ -85,7 +85,7 @@ def get_resource_and_action(action): def _set_rules(data): default_rule = 'default' - LOG.debug(_("loading policies from file: %s"), _POLICY_PATH) + LOG.debug(_("Loading policies from file: %s"), _POLICY_PATH) # Ensure backward compatibility with folsom/grizzly convention # for extension rules policies = policy.Rules.load_json(data, default_rule) diff --git a/neutron/quota.py b/neutron/quota.py index d2d6a7595..02a7cebd6 100644 --- a/neutron/quota.py +++ b/neutron/quota.py @@ -44,7 +44,7 @@ quota_opts = [ 'minus for unlimited')), cfg.IntOpt('quota_port', default=50, - help=_('number of ports allowed per tenant, minus for ' + help=_('Number of ports allowed per tenant, minus for ' 'unlimited')), cfg.StrOpt('quota_driver', default='neutron.quota.ConfDriver', diff --git a/neutron/service.py b/neutron/service.py index b90510ce5..cd88a6015 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -38,9 +38,9 @@ service_opts = [ help=_('Seconds between running periodic tasks')), cfg.IntOpt('periodic_fuzzy_delay', default=5, - help=_('range of seconds to randomly delay when starting the' - ' periodic task scheduler to reduce stampeding.' - ' (Disable by setting to 0)')), + help=_('Range of seconds to randomly delay when starting the ' + 'periodic task scheduler to reduce stampeding. ' + '(Disable by setting to 0)')), ] CONF = cfg.CONF CONF.register_opts(service_opts) diff --git a/neutron/services/firewall/agents/varmour/varmour_router.py b/neutron/services/firewall/agents/varmour/varmour_router.py index 0916533e6..d7f3efe2e 100755 --- a/neutron/services/firewall/agents/varmour/varmour_router.py +++ b/neutron/services/firewall/agents/varmour/varmour_router.py @@ -282,10 +282,10 @@ class vArmourL3NATAgent(l3_agent.L3NATAgent, try: plist = resp['body']['response'] except ValueError: - LOG.warn(_("unable to parse interface mapping.")) + LOG.warn(_("Unable to parse interface mapping.")) return else: - LOG.warn(_("unable to read interface mapping.")) + LOG.warn(_("Unable to read interface mapping.")) return if ri.ex_gw_port: diff --git a/neutron/services/loadbalancer/agent_scheduler.py b/neutron/services/loadbalancer/agent_scheduler.py index 084496e6c..95afe1c18 100644 --- a/neutron/services/loadbalancer/agent_scheduler.py +++ b/neutron/services/loadbalancer/agent_scheduler.py @@ -99,7 +99,7 @@ class ChanceScheduler(object): candidates = plugin.get_lbaas_agents(context, active=True) if not candidates: - LOG.warn(_('No active lbaas agents for pool %s') % pool['id']) + LOG.warn(_('No active lbaas agents for pool %s'), pool['id']) return chosen_agent = random.choice(candidates) diff --git a/neutron/services/loadbalancer/drivers/haproxy/agent_manager.py b/neutron/services/loadbalancer/drivers/haproxy/agent_manager.py index 41da44ae4..6d9cb1be5 100644 --- a/neutron/services/loadbalancer/drivers/haproxy/agent_manager.py +++ b/neutron/services/loadbalancer/drivers/haproxy/agent_manager.py @@ -178,7 +178,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks): self.agent_state) self.agent_state.pop('start_flag', None) except Exception: - LOG.exception("Failed reporting state!") + LOG.exception(_("Failed reporting state!")) def initialize_service_hook(self, started_by): self.sync_state() diff --git a/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py b/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py index 27ee9e204..20f85c72e 100644 --- a/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py +++ b/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py @@ -117,7 +117,7 @@ class HaproxyNSDriver(object): pool_stats['members'] = self._get_servers_stats(parsed_stats) return pool_stats else: - LOG.warn(_('Stats socket not found for pool %s') % pool_id) + LOG.warn(_('Stats socket not found for pool %s'), pool_id) return {} def _get_backend_stats(self, parsed_stats): diff --git a/neutron/services/loadbalancer/drivers/haproxy/plugin_driver.py b/neutron/services/loadbalancer/drivers/haproxy/plugin_driver.py index 01a5f02a1..cb1c14dc7 100644 --- a/neutron/services/loadbalancer/drivers/haproxy/plugin_driver.py +++ b/neutron/services/loadbalancer/drivers/haproxy/plugin_driver.py @@ -82,7 +82,7 @@ class LoadBalancerCallbacks(object): if not agents: return [] elif len(agents) > 1: - LOG.warning(_('Multiple lbaas agents found on host %s') % host) + LOG.warning(_('Multiple lbaas agents found on host %s'), host) pools = self.plugin.list_pools_on_lbaas_agent(context, agents[0].id) diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index a61a8eb38..20ea1a590 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -92,7 +92,7 @@ class MeteringAgent(MeteringPluginRpc, manager.Manager): def _load_drivers(self): """Loads plugin-driver from configuration.""" - LOG.info(_("Loading Metering driver %s") % self.conf.driver) + LOG.info(_("Loading Metering driver %s"), self.conf.driver) if not self.conf.driver: raise SystemExit(_('A metering driver must be specified')) self.metering_driver = importutils.import_object( @@ -109,7 +109,7 @@ class MeteringAgent(MeteringPluginRpc, manager.Manager): 'last_update': info['last_update'], 'host': self.host} - LOG.debug("Send metering report: %s" % data) + LOG.debug(_("Send metering report: %s"), data) notifier_api.notify(self.context, notifier_api.publisher_id('metering'), 'l3.meter', diff --git a/neutron/services/metering/drivers/iptables/iptables_driver.py b/neutron/services/metering/drivers/iptables/iptables_driver.py index 6218469fc..dd0ff16a3 100644 --- a/neutron/services/metering/drivers/iptables/iptables_driver.py +++ b/neutron/services/metering/drivers/iptables/iptables_driver.py @@ -96,7 +96,7 @@ class IptablesMeteringDriver(abstract_driver.MeteringAbstractDriver): if not self.conf.interface_driver: raise SystemExit(_('An interface driver must be specified')) - LOG.info(_("Loading interface driver %s") % self.conf.interface_driver) + LOG.info(_("Loading interface driver %s"), self.conf.interface_driver) self.driver = importutils.import_object(self.conf.interface_driver, self.conf) diff --git a/neutron/services/vpn/device_drivers/ipsec.py b/neutron/services/vpn/device_drivers/ipsec.py index 1ede7543a..fda64798b 100644 --- a/neutron/services/vpn/device_drivers/ipsec.py +++ b/neutron/services/vpn/device_drivers/ipsec.py @@ -58,13 +58,13 @@ openswan_opts = [ default=os.path.join( TEMPLATE_PATH, 'template/openswan/ipsec.conf.template'), - help='Template file for ipsec configuration'), + help=_('Template file for ipsec configuration')), cfg.StrOpt( 'ipsec_secret_template', default=os.path.join( TEMPLATE_PATH, 'template/openswan/ipsec.secret.template'), - help='Template file for ipsec secret configuration') + help=_('Template file for ipsec secret configuration')) ] cfg.CONF.register_opts(openswan_opts, 'openswan') diff --git a/neutron/wsgi.py b/neutron/wsgi.py index 6bac0f447..d44ecc8ae 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -102,7 +102,7 @@ class Server(object): family = info[0] bind_addr = info[-1] except Exception: - LOG.exception(_("Unable to listen on %(host)s:%(port)s") % + LOG.exception(_("Unable to listen on %(host)s:%(port)s"), {'host': host, 'port': port}) sys.exit(1) diff --git a/tools/i18n_cfg.py b/tools/i18n_cfg.py index abc1bfb14..5ad1a514d 100644 --- a/tools/i18n_cfg.py +++ b/tools/i18n_cfg.py @@ -94,4 +94,4 @@ msg_format_checkers = [ file_black_list = ["./neutron/tests/unit", "./neutron/openstack", - "./quantum/plugins/bigswitch/tests"] + "./neutron/plugins/bigswitch/tests"]