From 64163a6e001f0736e8c0ba09b93ee88b66ab6c88 Mon Sep 17 00:00:00 2001 From: Dmitriy Chubinidze Date: Thu, 11 Sep 2025 22:08:29 +0000 Subject: [PATCH] Revert "Making IP protocol field required" This reverts commit 9445725a9e56956ea06d4338fc4cccd9bb89ad94. Reason for revert: Making ip_protocol mandatory breaks presets in SECURITY_GROUP_RULES (e.g., "All TCP", "SSH" etc) because the field is hidden in the form. Change-Id: I3a17c8ec60e1004ae96200370791078483308af2 Closes-Bug: #2122416 Signed-off-by: Dmitriy Chubinidze --- .../dashboards/project/security_groups/forms.py | 9 ++++++--- .../dashboards/project/security_groups/tests.py | 9 +++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openstack_dashboard/dashboards/project/security_groups/forms.py b/openstack_dashboard/dashboards/project/security_groups/forms.py index 37a9bb3c6e..94e951a567 100644 --- a/openstack_dashboard/dashboards/project/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/security_groups/forms.py @@ -126,9 +126,8 @@ class AddRule(forms.SelfHandlingForm): })) ip_protocol = forms.IntegerField( - label=_('IP Protocol'), required=True, - help_text=_("Enter an integer value between -1 and 255 " - "(-1 means wild card)."), + label=_('IP Protocol'), required=False, + help_text=_("Enter an integer value between 0 and 255."), validators=[utils_validators.validate_ip_protocol], widget=forms.TextInput(attrs={ 'class': 'switched', @@ -284,6 +283,10 @@ class AddRule(forms.SelfHandlingForm): self.fields['direction'].choices = [('ingress', _('Ingress')), ('egress', _('Egress'))] + self.fields['ip_protocol'].help_text = _( + "Enter an integer value between -1 and 255 " + "(-1 means wild card)." + ) self.fields['port_or_range'].choices = [ ('port', _('Port')), diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py index 73c1abe207..15bd854830 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/security_groups/tests.py @@ -461,8 +461,7 @@ class SecurityGroupsViewTests(test.TestCase): 'rule_menu': 'http', 'port_or_range': 'port', 'cidr': rule.ip_range['cidr'], - 'remote': 'cidr', - 'ip_protocol': 6} + 'remote': 'cidr'} res = self.client.post(self.edit_url, formData) self.assertRedirectsNoFollow(res, self.detail_url) @@ -545,8 +544,7 @@ class SecurityGroupsViewTests(test.TestCase): 'port_or_range': 'port', 'cidr': '0.0.0.0/0', 'security_group': sec_group.id, - 'remote': 'sg', - 'ip_protocol': 6} + 'remote': 'sg'} res = self.client.post(self.edit_url, formData) self.assertRedirectsNoFollow(res, self.detail_url) @@ -933,8 +931,7 @@ class SecurityGroupsViewTests(test.TestCase): 'port_or_range': 'range', 'rule_menu': 'all_tcp', 'cidr': rule.ip_range['cidr'], - 'remote': 'cidr', - 'ip_protocol': 6} + 'remote': 'cidr'} res = self.client.post(self.edit_url, formData) self.assertRedirectsNoFollow(res, self.detail_url)