Merge "Modify the error message when creating subnet"
This commit is contained in:
commit
4cb09d1d7f
@ -41,7 +41,7 @@ class CreateSubnetInfoAction(network_workflows.CreateSubnetInfoAction):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = workflows.Action.clean(self)
|
cleaned_data = workflows.Action.clean(self)
|
||||||
self._check_subnet_data(cleaned_data)
|
self._check_subnet_data(cleaned_data, with_network_form=False)
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,8 @@ class UpdateSubnetInfoAction(CreateSubnetInfoAction):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = workflows.Action.clean(self)
|
cleaned_data = workflows.Action.clean(self)
|
||||||
self._check_subnet_data(cleaned_data, is_create=False)
|
self._check_subnet_data(cleaned_data, is_create=False,
|
||||||
|
with_network_form=False)
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,7 +279,8 @@ class CreateSubnetInfoAction(workflows.Action):
|
|||||||
'allowed': range_str})
|
'allowed': range_str})
|
||||||
raise forms.ValidationError(msg)
|
raise forms.ValidationError(msg)
|
||||||
|
|
||||||
def _check_subnet_data(self, cleaned_data, is_create=True):
|
def _check_subnet_data(self, cleaned_data, is_create=True,
|
||||||
|
with_network_form=True):
|
||||||
cidr = cleaned_data.get('cidr')
|
cidr = cleaned_data.get('cidr')
|
||||||
ip_version = int(cleaned_data.get('ip_version'))
|
ip_version = int(cleaned_data.get('ip_version'))
|
||||||
gateway_ip = cleaned_data.get('gateway_ip')
|
gateway_ip = cleaned_data.get('gateway_ip')
|
||||||
@ -293,8 +294,11 @@ class CreateSubnetInfoAction(workflows.Action):
|
|||||||
'"Network Address".')
|
'"Network Address".')
|
||||||
raise forms.ValidationError(msg)
|
raise forms.ValidationError(msg)
|
||||||
if not cidr and address_source != 'subnetpool':
|
if not cidr and address_source != 'subnetpool':
|
||||||
|
if with_network_form:
|
||||||
msg = _('Specify "Network Address" or '
|
msg = _('Specify "Network Address" or '
|
||||||
'clear "Create Subnet" checkbox in previous step.')
|
'clear "Create Subnet" checkbox in previous step.')
|
||||||
|
else:
|
||||||
|
msg = _("Specify network address")
|
||||||
raise forms.ValidationError(msg)
|
raise forms.ValidationError(msg)
|
||||||
if cidr:
|
if cidr:
|
||||||
subnet = netaddr.IPNetwork(cidr)
|
subnet = netaddr.IPNetwork(cidr)
|
||||||
|
Loading…
Reference in New Issue
Block a user