Merge "Fix InvalidInput exception output"

This commit is contained in:
Jenkins 2016-11-24 10:49:18 +00:00 committed by Gerrit Code Review
commit 41d2c23560
4 changed files with 9 additions and 9 deletions

View File

@ -169,7 +169,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
@ -278,7 +278,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']))
@ -293,7 +293,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):
@ -485,7 +485,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)
@ -493,11 +493,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

@ -198,7 +198,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)