Revert "Making IP protocol field required"
This reverts commit 9445725a9e.
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 <dcu995@gmail.com>
This commit is contained in:
committed by
Gerrit Code Review
parent
9445725a9e
commit
64163a6e00
@@ -126,9 +126,8 @@ class AddRule(forms.SelfHandlingForm):
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
ip_protocol = forms.IntegerField(
|
ip_protocol = forms.IntegerField(
|
||||||
label=_('IP Protocol'), required=True,
|
label=_('IP Protocol'), required=False,
|
||||||
help_text=_("Enter an integer value between -1 and 255 "
|
help_text=_("Enter an integer value between 0 and 255."),
|
||||||
"(-1 means wild card)."),
|
|
||||||
validators=[utils_validators.validate_ip_protocol],
|
validators=[utils_validators.validate_ip_protocol],
|
||||||
widget=forms.TextInput(attrs={
|
widget=forms.TextInput(attrs={
|
||||||
'class': 'switched',
|
'class': 'switched',
|
||||||
@@ -284,6 +283,10 @@ class AddRule(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
self.fields['direction'].choices = [('ingress', _('Ingress')),
|
self.fields['direction'].choices = [('ingress', _('Ingress')),
|
||||||
('egress', _('Egress'))]
|
('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 = [
|
self.fields['port_or_range'].choices = [
|
||||||
('port', _('Port')),
|
('port', _('Port')),
|
||||||
|
|||||||
@@ -461,8 +461,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||||||
'rule_menu': 'http',
|
'rule_menu': 'http',
|
||||||
'port_or_range': 'port',
|
'port_or_range': 'port',
|
||||||
'cidr': rule.ip_range['cidr'],
|
'cidr': rule.ip_range['cidr'],
|
||||||
'remote': 'cidr',
|
'remote': 'cidr'}
|
||||||
'ip_protocol': 6}
|
|
||||||
res = self.client.post(self.edit_url, formData)
|
res = self.client.post(self.edit_url, formData)
|
||||||
self.assertRedirectsNoFollow(res, self.detail_url)
|
self.assertRedirectsNoFollow(res, self.detail_url)
|
||||||
|
|
||||||
@@ -545,8 +544,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||||||
'port_or_range': 'port',
|
'port_or_range': 'port',
|
||||||
'cidr': '0.0.0.0/0',
|
'cidr': '0.0.0.0/0',
|
||||||
'security_group': sec_group.id,
|
'security_group': sec_group.id,
|
||||||
'remote': 'sg',
|
'remote': 'sg'}
|
||||||
'ip_protocol': 6}
|
|
||||||
res = self.client.post(self.edit_url, formData)
|
res = self.client.post(self.edit_url, formData)
|
||||||
self.assertRedirectsNoFollow(res, self.detail_url)
|
self.assertRedirectsNoFollow(res, self.detail_url)
|
||||||
|
|
||||||
@@ -933,8 +931,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||||||
'port_or_range': 'range',
|
'port_or_range': 'range',
|
||||||
'rule_menu': 'all_tcp',
|
'rule_menu': 'all_tcp',
|
||||||
'cidr': rule.ip_range['cidr'],
|
'cidr': rule.ip_range['cidr'],
|
||||||
'remote': 'cidr',
|
'remote': 'cidr'}
|
||||||
'ip_protocol': 6}
|
|
||||||
res = self.client.post(self.edit_url, formData)
|
res = self.client.post(self.edit_url, formData)
|
||||||
self.assertRedirectsNoFollow(res, self.detail_url)
|
self.assertRedirectsNoFollow(res, self.detail_url)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user