summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpengyuesheng <pengyuesheng@gohighsec.com>2019-01-17 14:12:56 +0800
committerpengyuesheng <pengyuesheng@gohighsec.com>2019-01-18 13:37:56 +0800
commit4624438f17a1b2e122233aae1b907260d942784f (patch)
tree62aaac6df8bcc2cad2b15b43d7b1011a91fcce0e
parent64542397d8c1ba67d9c83e350d8bc46c8e390453 (diff)
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
Notes
Notes (review): Code-Review+2: Akihiro Motoki <amotoki@gmail.com> Code-Review+2: Ivan Kolodyazhny <e0ne@e0ne.info> Workflow+1: Ivan Kolodyazhny <e0ne@e0ne.info> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 23 Jan 2019 14:32:56 +0000 Reviewed-on: https://review.openstack.org/631423 Project: openstack/horizon Branch: refs/heads/master
-rw-r--r--openstack_dashboard/dashboards/project/networks/subnets/workflows.py5
-rw-r--r--openstack_dashboard/dashboards/project/networks/workflows.py10
2 files changed, 10 insertions, 5 deletions
diff --git a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py
index 277648a..85ca977 100644
--- a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py
+++ b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py
@@ -41,7 +41,7 @@ class CreateSubnetInfoAction(network_workflows.CreateSubnetInfoAction):
41 41
42 def clean(self): 42 def clean(self):
43 cleaned_data = workflows.Action.clean(self) 43 cleaned_data = workflows.Action.clean(self)
44 self._check_subnet_data(cleaned_data) 44 self._check_subnet_data(cleaned_data, with_network_form=False)
45 return cleaned_data 45 return cleaned_data
46 46
47 47
@@ -114,7 +114,8 @@ class UpdateSubnetInfoAction(CreateSubnetInfoAction):
114 114
115 def clean(self): 115 def clean(self):
116 cleaned_data = workflows.Action.clean(self) 116 cleaned_data = workflows.Action.clean(self)
117 self._check_subnet_data(cleaned_data, is_create=False) 117 self._check_subnet_data(cleaned_data, is_create=False,
118 with_network_form=False)
118 return cleaned_data 119 return cleaned_data
119 120
120 121
diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py
index 8a9683c..81e81ab 100644
--- a/openstack_dashboard/dashboards/project/networks/workflows.py
+++ b/openstack_dashboard/dashboards/project/networks/workflows.py
@@ -279,7 +279,8 @@ class CreateSubnetInfoAction(workflows.Action):
279 'allowed': range_str}) 279 'allowed': range_str})
280 raise forms.ValidationError(msg) 280 raise forms.ValidationError(msg)
281 281
282 def _check_subnet_data(self, cleaned_data, is_create=True): 282 def _check_subnet_data(self, cleaned_data, is_create=True,
283 with_network_form=True):
283 cidr = cleaned_data.get('cidr') 284 cidr = cleaned_data.get('cidr')
284 ip_version = int(cleaned_data.get('ip_version')) 285 ip_version = int(cleaned_data.get('ip_version'))
285 gateway_ip = cleaned_data.get('gateway_ip') 286 gateway_ip = cleaned_data.get('gateway_ip')
@@ -293,8 +294,11 @@ class CreateSubnetInfoAction(workflows.Action):
293 '"Network Address".') 294 '"Network Address".')
294 raise forms.ValidationError(msg) 295 raise forms.ValidationError(msg)
295 if not cidr and address_source != 'subnetpool': 296 if not cidr and address_source != 'subnetpool':
296 msg = _('Specify "Network Address" or ' 297 if with_network_form:
297 'clear "Create Subnet" checkbox in previous step.') 298 msg = _('Specify "Network Address" or '
299 'clear "Create Subnet" checkbox in previous step.')
300 else:
301 msg = _("Specify network address")
298 raise forms.ValidationError(msg) 302 raise forms.ValidationError(msg)
299 if cidr: 303 if cidr:
300 subnet = netaddr.IPNetwork(cidr) 304 subnet = netaddr.IPNetwork(cidr)