From 29273adaf9c31fa22e4580c5af6eb9469290d38c Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 31 Aug 2016 06:06:43 -0700 Subject: [PATCH] Fix InvalidInput exception output Ensure that only one period ends the data. The exception adds the period so no need to pass the error_message with a period. TrivialFix Change-Id: I411534fc7ea56946a72890808154cc43ba3b6c1d Closes-bug: #1618881 --- neutron/db/db_base_plugin_v2.py | 12 ++++++------ neutron/db/external_net_db.py | 2 +- neutron/db/ipam_backend_mixin.py | 2 +- neutron/extensions/tag.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index ff251e8b63e..0f2df0ba7b8 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -170,7 +170,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, # _get_network will succeed on a shared network if not context.is_admin and net['tenant_id'] != context.tenant_id: msg = _("Only admins can manipulate policies on networks " - "they do not own.") + "they do not own") raise exc.InvalidInput(error_message=msg) tenant_to_check = None @@ -279,7 +279,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, if netaddr.IPNetwork(subnet['cidr']).prefixlen != 64: msg = _('Invalid CIDR %s for IPv6 address mode. ' 'OpenStack uses the EUI-64 address format, ' - 'which requires the prefix to be /64.') + 'which requires the prefix to be /64') raise exc.InvalidInput( error_message=(msg % subnet['cidr'])) @@ -294,7 +294,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, def _validate_ipv6_dhcp(self, ra_mode_set, address_mode_set, enable_dhcp): if (ra_mode_set or address_mode_set) and not enable_dhcp: msg = _("ipv6_ra_mode or ipv6_address_mode cannot be set when " - "enable_dhcp is set to False.") + "enable_dhcp is set to False") raise exc.InvalidInput(error_message=msg) def _validate_ipv6_update_dhcp(self, subnet, cur_subnet): @@ -486,7 +486,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, if s.get('enable_dhcp') and not dhcp_was_enabled: subnet_prefixlen = netaddr.IPNetwork(s['cidr']).prefixlen error_message = _("Subnet has a prefix length that is " - "incompatible with DHCP service enabled.") + "incompatible with DHCP service enabled") if ((ip_ver == 4 and subnet_prefixlen > 30) or (ip_ver == 6 and subnet_prefixlen > 126)): raise exc.InvalidInput(error_message=error_message) @@ -494,11 +494,11 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, net = netaddr.IPNetwork(s['cidr']) if net.is_multicast(): error_message = _("Multicast IP subnet is not supported " - "if enable_dhcp is True.") + "if enable_dhcp is True") raise exc.InvalidInput(error_message=error_message) elif net.is_loopback(): error_message = _("Loopback IP subnet is not supported " - "if enable_dhcp is True.") + "if enable_dhcp is True") raise exc.InvalidInput(error_message=error_message) if validators.is_attr_set(s.get('gateway_ip')): diff --git a/neutron/db/external_net_db.py b/neutron/db/external_net_db.py index fe00f57c4ca..ed66d1a4ed9 100644 --- a/neutron/db/external_net_db.py +++ b/neutron/db/external_net_db.py @@ -200,7 +200,7 @@ class External_net_db_mixin(object): net = self.get_network(context, policy['object_id']) if not context.is_admin and net['tenant_id'] != context.tenant_id: msg = _("Only admins can manipulate policies on networks they " - "do not own.") + "do not own") raise n_exc.InvalidInput(error_message=msg) if not self._network_is_external(context, policy['object_id']): # we automatically convert the network into an external network diff --git a/neutron/db/ipam_backend_mixin.py b/neutron/db/ipam_backend_mixin.py index f1236715f3f..b0be269a9b4 100644 --- a/neutron/db/ipam_backend_mixin.py +++ b/neutron/db/ipam_backend_mixin.py @@ -324,7 +324,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon): return if len(fixed_ip_list) > cfg.CONF.max_fixed_ips_per_port: - msg = _('Exceeded maximum amount of fixed ips per port.') + msg = _('Exceeded maximum amount of fixed ips per port') raise exc.InvalidInput(error_message=msg) def _validate_segment(self, context, network_id, segment_id): diff --git a/neutron/extensions/tag.py b/neutron/extensions/tag.py index a09dfa97796..407938f5be3 100644 --- a/neutron/extensions/tag.py +++ b/neutron/extensions/tag.py @@ -66,7 +66,7 @@ def validate_tag(tag): def validate_tags(body): if 'tags' not in body: - raise exceptions.InvalidInput(error_message="Invalid tags body.") + raise exceptions.InvalidInput(error_message=_("Invalid tags body")) msg = validators.validate_list_of_unique_strings(body['tags'], MAX_TAG_LEN) if msg: raise exceptions.InvalidInput(error_message=msg)