]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix message i18n error
authorZhiQiang Fan <aji.zqfan@gmail.com>
Tue, 27 Aug 2013 00:02:04 +0000 (08:02 +0800)
committerZhiQiang Fan <aji.zqfan@gmail.com>
Sun, 8 Sep 2013 07:58:12 +0000 (15:58 +0800)
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

58 files changed:
neutron/agent/dhcp_agent.py
neutron/common/exceptions.py
neutron/db/dhcp_rpc_base.py
neutron/db/extraroute_db.py
neutron/db/l3_rpc_base.py
neutron/debug/commands.py
neutron/extensions/providernet.py
neutron/plugins/bigswitch/plugin.py
neutron/plugins/bigswitch/routerrule_db.py
neutron/plugins/brocade/NeutronPlugin.py
neutron/plugins/cisco/common/config.py
neutron/plugins/cisco/db/n1kv_db_v2.py
neutron/plugins/cisco/models/virt_phy_sw_v2.py
neutron/plugins/cisco/n1kv/n1kv_client.py
neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py
neutron/plugins/cisco/network_plugin.py
neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py
neutron/plugins/embrane/base_plugin.py
neutron/plugins/embrane/common/config.py
neutron/plugins/embrane/l2base/support_exceptions.py
neutron/plugins/hyperv/agent/hyperv_neutron_agent.py
neutron/plugins/hyperv/agent/utils.py
neutron/plugins/hyperv/agent/utilsfactory.py
neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py
neutron/plugins/midonet/midonet_lib.py
neutron/plugins/ml2/drivers/cisco/config.py
neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py
neutron/plugins/ml2/drivers/type_tunnel.py
neutron/plugins/mlnx/agent/eswitch_neutron_agent.py
neutron/plugins/mlnx/common/config.py
neutron/plugins/mlnx/db/mlnx_db_v2.py
neutron/plugins/mlnx/mlnx_plugin.py
neutron/plugins/mlnx/rpc_callbacks.py
neutron/plugins/nec/nec_plugin.py
neutron/plugins/nec/packet_filter.py
neutron/plugins/nicira/NeutronPlugin.py
neutron/plugins/nicira/common/config.py
neutron/plugins/nicira/extensions/nvp_networkgw.py
neutron/plugins/nicira/nvplib.py
neutron/plugins/nicira/vshield/tasks/tasks.py
neutron/plugins/openvswitch/ovs_db_v2.py
neutron/plugins/plumgrid/drivers/fake_plumlib.py
neutron/plugins/plumgrid/drivers/plumlib.py
neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py
neutron/plugins/ryu/agent/ryu_neutron_agent.py
neutron/policy.py
neutron/quota.py
neutron/service.py
neutron/services/firewall/agents/varmour/varmour_router.py
neutron/services/loadbalancer/agent_scheduler.py
neutron/services/loadbalancer/drivers/haproxy/agent_manager.py
neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py
neutron/services/loadbalancer/drivers/haproxy/plugin_driver.py
neutron/services/metering/agents/metering_agent.py
neutron/services/metering/drivers/iptables/iptables_driver.py
neutron/services/vpn/device_drivers/ipsec.py
neutron/wsgi.py
tools/i18n_cfg.py

index 251b835c465ba962465582c1d146de8133aeb661..b76e0f0f8b8ef9b1febb00d64930ea3d0c83fe61 100644 (file)
@@ -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)
index 5c9f8dd755aa9bd03dbb95c636752e86e2bf1c7c..cc64089be6a90f99a41fccbb71c1c0900748fad7 100644 (file)
@@ -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):
index ee6c3db1a5d197da3168476ce45b576ff5e1c551..a8a2b4bf2ade48651785aa8efadad4a6fbcd1d70 100644 (file)
@@ -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."""
index 7e8b7b3a70d80c8132004f8f03a370abae30bb55..2a286988923faebc2e2b6f74cb781b7f8155e82d 100644 (file)
@@ -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'],
index afd64afe7a087ee5ecad7eccf398431c22c24390..24f754bc5c84b2b6e2feafee0d8081e23ce75b9d 100644 (file)
@@ -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, []):
index d2da9e89719b4f1658c8413e3c5a19867063b17f..829ed22cc209003f542c9f4bfcf95129472450c1 100644 (file)
@@ -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):
index dab7fa7b879f67e5f7897bf3b88d12cb4006db8c..a51a215b7a5d11043bfbaf9183eca8aa45464ca4 100644 (file)
@@ -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)
 
 
index 1588e5deb82408042838060af9e2452ad65a2086..2d7746a0d8b89a6b36c0c3dc440d67b31c0cecea 100644 (file)
@@ -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:
index 1e6b4b933989e7f973eaa90ac78945ae65bf8fbf..e947a1f9db84cd740fa6efa9d051084faa0cba80 100644 (file)
@@ -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'],
index 1534a312cfd6d2c7f1976f671fd5cb29827a3fa3..2f0a169b777ca1b0cfca26370fe7f604bf719721 100644 (file)
@@ -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,
index a7c8953ee0c2cb323e4a0020764f0eca49457abf..04d05d186771e9c0f3d859c00190b5b40abb3842 100644 (file)
@@ -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():
index 4167933ccceec6d4cfaa81dab965f10eab473b5c..8fe347de77f143eba54fb2b89404ae9f09c0247e 100644 (file)
@@ -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)
 
index 4b42a095f5f362aa58628e6c849ff9c3fa5ec320..2f58f7566cec6a8d3456dcd152e39d9ab5898405 100644 (file)
@@ -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):
index 69e9c4f78d5139f2e0314046aeb40aabf35e3a25..1334b161aca1b0e7518f36f87ca6eb709bb610f1 100644 (file)
@@ -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):
index ed00c50c5549a18f9a878a9b630fc57abd989d34..fe0693bfc0e7827e38b6f3d98b329469286f12f8 100644 (file)
@@ -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,
index c0ef874eb4772e7ec3bd7b99affaaf0cfee64802..f64822f51d18e71e5de7b0d98e72bcd55c8fd266 100644 (file)
@@ -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.
index 4f700b46c89eb3d0d7f3ece71fbbe9c95d8e930d..548ba260bdd76a0e135cc3a851d68124a42162bb 100644 (file)
@@ -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:
index 2aa981f01bba1f3beef3715e03fc72487da36b6c..2db95e877870e5b372fc4eb8994ab1eb2981a003 100644 (file)
@@ -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,
index bbf825b9b7720f1bf3946f689f3bdc3599259f6c..b376056fcc28d9713c6a6a8e9df2739cc7ab2682 100644 (file)
@@ -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')),
 ]
 
index 3af17e3118cf2298d03c1eeefabdf93955098491..1c5c013228e70a50fcb0406602031cd8168ecedb 100644 (file)
@@ -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")
index d5befb11c70cdf862d66fa411373fdc039f58fa7..b86aa51352417974dc2321749c50307f0957c64c 100644 (file)
@@ -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'],
index 2b6d56f66fe36906ffdb51ac38ce00c02fcc1dfe..3e26caef46ab91f70e5f5e6d7d91ce2ac731ff08 100644 (file)
@@ -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):
index cd1c13134560a9ed5ff075ecac4aa8b5bb172994..8d594a223ad1c0ea6640f8cb541a8dcce0272e94 100644 (file)
@@ -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
 
index b9e4d42c11d71f263717549a213db29c2e7bf4d8..79c0f92f527b64651e8cca1c86f1bdd185d152d6 100755 (executable)
@@ -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)
index e5f74dabbae92f9477466b9950ad70f8ddb89f51..ef6dec7a3ae12201d205de8e4bc42d83fba27129 100644 (file)
@@ -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
index cf47dc4430a7b60a6023dc6c14429654d0c075f3..c1d7ac1d37ff58486bc3fd492e42ba5032a8d3b2 100644 (file)
@@ -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():
index c72358b63e3eb586394a17b44b046053bab7c9da..f8f2cbbab02273d9ee2e8fdaa01dd1e230e0b95d 100644 (file)
@@ -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:
index 341a023f22722378bfa85b01860abce7778ee906..a761bf26b17be17e4634f7fded6412d8fc68f204 100644 (file)
@@ -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:
index e05fac15b93c0e8538311932e24da6076f1240a9..c82dd9f83b01629f66e3c5332f13bd50c919daf6 100644 (file)
@@ -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)
index 490d9235219cfa17ebd5d8376ad16f4c50df8e4a..8375067492daaa121d0cf6c50580b7fcb1e753e5 100644 (file)
@@ -40,7 +40,7 @@ eswitch_opts = [
                 help=_("List of <physical_network>:<physical_interface>")),
     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',
index 701f5b27fc365d9d4619293771da2dfd551c96bb..f730824ede58439b2808be47b15c08761386514e 100644 (file)
@@ -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})
index 87243a9cca76fe039f8cc13fdb0b5b6edc1b62db..7c5d550cd846349dcea6dc179a3a3ced8c05df95 100644 (file)
@@ -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)
index 36e54fd7079c6a09f394ff69f777e278ecbd6fea..6b9633635b56c1e761cd75693224c3b4d7d1b755 100644 (file)
@@ -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):
index 158d42ea9fa3d244522c34c073daf291198beb13..bbca6b47cd05298e340a0c9d6974f19e2a49edd4 100644 (file)
@@ -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
 
index b11e1e4751e186b783b64c5cd2db2b51330a3f25..8c30bd420f2c3a45a0e1144148df0850e16774e0 100644 (file)
@@ -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:
index af4a6ff4f7af676aab5d6e9571321f0d76757d4f..3f74ac1d3652cf6db9bf5f83fc218d18de9e7b81 100644 (file)
@@ -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):
index 721294e598f04505b706b873d141e255449ef922..05e88572383fb5d3666673a820a06061f2bbf846 100644 (file)
@@ -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():
index cd9e45fd04d88ecf6ab2ba2213b6144354ba3975..58558153dc9f301092b27d16ce7f1246d080609b 100644 (file)
@@ -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'))
 ]
 
index a65dfc08aab2655e3564c3853601d31c98bb103d..cb5975dbfe909313f2253905c9fe7758c672d0f9 100644 (file)
@@ -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)
 
 
index 2128b3cbd671061883cdaf3f852011e6242ac4fb..a2c2809073a25bbf3f90ca92d26cda8c14b14d54 100755 (executable)
@@ -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()
 
index 4eb9015e2187522f6b284c386d4f4d55497e3714..3c52481b7eba8bebf16279f4c1d3f7b5b85db3da 100644 (file)
@@ -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'))
index 8b94341b45ca068212ca0aea52f016ab572b3775..28f32977c2216873f592aaf01d57401133cbefc3 100644 (file)
@@ -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):
index 9f66c4a489f11e212c6e4e4d953716e499b142ac..4c71f80caecac1bbaf249d6dad137ee593a2c030 100644 (file)
@@ -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):
index 5e6aaf5eda0cc06ab99a2e7009536360d651211d..2d4833363f3de0cfef50642eb6abaf747e8584f8 100644 (file)
@@ -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',
index 7534a5b92236739f7497b559097c7f411751f406..dddbe15cb3b6938d6a23b4c011bca824cd5ecf53 100755 (executable)
@@ -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:
index 2d25a8d7756a142714d7b20dd52f1f8207fcf7c8..a129813a2139dad48e17633ce25e791c51effe5c 100644 (file)
@@ -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)
index d2d6a759550391d61beb8d6b76b8ee292768055f..02a7cebd61dffa5e0b8f864777f8493263cc55de 100644 (file)
@@ -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',
index b90510ce51918fcf1c921120903041dd6ae52f1c..cd88a6015685e16e951c71139a63b3e67af8ce7c 100644 (file)
@@ -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)
index 0916533e64e97936ec237d64e99b9fc63a4446c6..d7f3efe2e82721004f94d7a16e1d39f88a0b76a1 100755 (executable)
@@ -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:
index 084496e6c19171b055c43b8d0664b33d733e1a2a..95afe1c18804b3dde1b2e384e5fa8634071717ed 100644 (file)
@@ -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)
index 41da44ae41d8bb20207195c41b1b23b02bd5e073..6d9cb1be5d85ba25bbf9f95c771c5946ec076afe 100644 (file)
@@ -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()
index 27ee9e2049349b840b1721713ca047389426e5e8..20f85c72e800b3676682852cee0ed1510292a694 100644 (file)
@@ -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):
index 01a5f02a1c230495d761f8f5bb22bdc9a2abb40e..cb1c14dc71f37c9dd1a951024f21b0d9202647f7 100644 (file)
@@ -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)
index a61a8eb38d64283f56e70cfc7904eb58c2ba7e80..20ea1a5902c01d006170e882061a9e4c40e6df4a 100644 (file)
@@ -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',
index 6218469fcf19236e46f1145f9068b80fd3e57a28..dd0ff16a34b8733e1fb911bc2bdaca5c3d61d425 100644 (file)
@@ -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)
 
index 1ede7543ac74ff59b19a0dbdfe269b9b9ebcec6a..fda64798bbb1857ae8e14362d47eed18f02b6f56 100644 (file)
@@ -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')
index 6bac0f447e683ea38d0f4d891a92de76c4a35ba1..d44ecc8aec8cce6df64b87e752ff979b5227e2b8 100644 (file)
@@ -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)
 
index abc1bfb14a03f5fa9384d24155f5336c81c6bd02..5ad1a514d97eb5127ae78bac2f912f2f2238267c 100644 (file)
@@ -94,4 +94,4 @@ msg_format_checkers = [
 
 file_black_list = ["./neutron/tests/unit",
                    "./neutron/openstack",
-                   "./quantum/plugins/bigswitch/tests"]
+                   "./neutron/plugins/bigswitch/tests"]