From 80580fa2e4486f03a7d49e9fca645d495f529ccc Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Thu, 1 Apr 2021 17:35:31 +0800 Subject: [PATCH] fix: avoid update protocol with any faild --- pkg/compute/models/secgrouprules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/compute/models/secgrouprules.go b/pkg/compute/models/secgrouprules.go index 87706865b6..6bb2f8b91d 100644 --- a/pkg/compute/models/secgrouprules.go +++ b/pkg/compute/models/secgrouprules.go @@ -339,7 +339,7 @@ func (self *SSecurityGroupRule) ValidateUpdateData(ctx context.Context, userCred if len(input.Protocol) == 0 { input.Protocol = self.Protocol } - if len(input.Ports) == 0 { + if len(input.Ports) == 0 && input.Protocol != string(secrules.PROTO_ANY) && input.Protocol != string(secrules.PROTO_ICMP) { input.Ports = self.Ports }