Modify the error message when creating subnet
The error message is incorrect: 'Specify "Network Address" or clear "Create Subnet" checkbox in previous step' on create subnet page, It has no previous step Change-Id: Ib91c29d8de7f75744f38bd624234e6f2416673e1 Closes-Bug: #1812157
This commit is contained in:
parent
64542397d8
commit
4624438f17
|
@ -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':
|
||||||
msg = _('Specify "Network Address" or '
|
if with_network_form:
|
||||||
'clear "Create Subnet" checkbox in previous step.')
|
msg = _('Specify "Network Address" or '
|
||||||
|
'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