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
This commit is contained in:
Gary Kotton 2016-08-31 06:06:43 -07:00 committed by garyk
parent f2235b7994
commit 29273adaf9
4 changed files with 9 additions and 9 deletions

View File

@ -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')):

View File

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

View File

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

View File

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