Browse Source

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
changes/04/43804/8
ZhiQiang Fan 9 years ago
parent
commit
9842dcb34c
  1. 2
      neutron/agent/dhcp_agent.py
  2. 2
      neutron/common/exceptions.py
  3. 2
      neutron/db/dhcp_rpc_base.py
  4. 4
      neutron/db/extraroute_db.py
  5. 4
      neutron/db/l3_rpc_base.py
  6. 2
      neutron/debug/commands.py
  7. 2
      neutron/extensions/providernet.py
  8. 14
      neutron/plugins/bigswitch/plugin.py
  9. 4
      neutron/plugins/bigswitch/routerrule_db.py
  10. 9
      neutron/plugins/brocade/NeutronPlugin.py
  11. 10
      neutron/plugins/cisco/common/config.py
  12. 22
      neutron/plugins/cisco/db/n1kv_db_v2.py
  13. 8
      neutron/plugins/cisco/models/virt_phy_sw_v2.py
  14. 4
      neutron/plugins/cisco/n1kv/n1kv_client.py
  15. 12
      neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py
  16. 5
      neutron/plugins/cisco/network_plugin.py
  17. 14
      neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py
  18. 6
      neutron/plugins/embrane/base_plugin.py
  19. 2
      neutron/plugins/embrane/common/config.py
  20. 2
      neutron/plugins/embrane/l2base/support_exceptions.py
  21. 15
      neutron/plugins/hyperv/agent/hyperv_neutron_agent.py
  22. 2
      neutron/plugins/hyperv/agent/utils.py
  23. 4
      neutron/plugins/hyperv/agent/utilsfactory.py
  24. 4
      neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py
  25. 3
      neutron/plugins/midonet/midonet_lib.py
  26. 2
      neutron/plugins/ml2/drivers/cisco/config.py
  27. 11
      neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py
  28. 2
      neutron/plugins/ml2/drivers/type_tunnel.py
  29. 8
      neutron/plugins/mlnx/agent/eswitch_neutron_agent.py
  30. 2
      neutron/plugins/mlnx/common/config.py
  31. 2
      neutron/plugins/mlnx/db/mlnx_db_v2.py
  32. 10
      neutron/plugins/mlnx/mlnx_plugin.py
  33. 2
      neutron/plugins/mlnx/rpc_callbacks.py
  34. 2
      neutron/plugins/nec/nec_plugin.py
  35. 6
      neutron/plugins/nec/packet_filter.py
  36. 10
      neutron/plugins/nicira/NeutronPlugin.py
  37. 2
      neutron/plugins/nicira/common/config.py
  38. 6
      neutron/plugins/nicira/extensions/nvp_networkgw.py
  39. 19
      neutron/plugins/nicira/nvplib.py
  40. 5
      neutron/plugins/nicira/vshield/tasks/tasks.py
  41. 3
      neutron/plugins/openvswitch/ovs_db_v2.py
  42. 5
      neutron/plugins/plumgrid/drivers/fake_plumlib.py
  43. 2
      neutron/plugins/plumgrid/drivers/plumlib.py
  44. 2
      neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py
  45. 2
      neutron/plugins/ryu/agent/ryu_neutron_agent.py
  46. 2
      neutron/policy.py
  47. 2
      neutron/quota.py
  48. 6
      neutron/service.py
  49. 4
      neutron/services/firewall/agents/varmour/varmour_router.py
  50. 2
      neutron/services/loadbalancer/agent_scheduler.py
  51. 2
      neutron/services/loadbalancer/drivers/haproxy/agent_manager.py
  52. 2
      neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py
  53. 2
      neutron/services/loadbalancer/drivers/haproxy/plugin_driver.py
  54. 4
      neutron/services/metering/agents/metering_agent.py
  55. 2
      neutron/services/metering/drivers/iptables/iptables_driver.py
  56. 4
      neutron/services/vpn/device_drivers/ipsec.py
  57. 2
      neutron/wsgi.py
  58. 2
      tools/i18n_cfg.py

2
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)

2
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):

2
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."""

4
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'],

4
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, []):

2
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):

2
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)

14
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:

4
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'],

9
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,

10
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():

22
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)

8
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):

4
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):

12
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,

5
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.

14
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:

6
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,

2
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')),
]

2
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")

15
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'],

2
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):

4
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

4
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)

3
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

2
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():

11
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:

2
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:

8
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)

2
neutron/plugins/mlnx/common/config.py

@ -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',

2
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})

10
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)

2
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):

2
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

6
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:

10
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):

2
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():

6
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'))
]

19
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)

5
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()

3
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'))

5
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):

2
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):

2
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',

2
neutron/plugins/ryu/agent/ryu_neutron_agent.py

@ -235,7 +235,7 @@ class OVSNeutronOFPRyuAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):