mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Automatic merge from release/2.2.0 -> release/2.3.0
* commit '309a2ca0b459a0466eab0229e8e25a899d888946': 大部分公有云不需要将安全组拆分为单个单个的规则
This commit is contained in:
@@ -280,6 +280,10 @@ func (self *SSecurityGroupRule) String() string {
|
||||
return fields[0] + strings.Join(fields[1:], " ")
|
||||
}
|
||||
|
||||
func (self *SSecurityGroupRule) toRule() (*secrules.SecurityRule, error) {
|
||||
return secrules.ParseSecurityRule(self.String())
|
||||
}
|
||||
|
||||
func (self *SSecurityGroupRule) SingleRules() ([]secrules.SecurityRule, error) {
|
||||
rules := make([]secrules.SecurityRule, 0)
|
||||
ruleStr := self.String()
|
||||
|
||||
@@ -124,11 +124,13 @@ func (self *SSecurityGroup) getSecurityRules(direction string) (rules []SSecurit
|
||||
func (self *SSecurityGroup) getSecRules(direction string) []secrules.SecurityRule {
|
||||
rules := make([]secrules.SecurityRule, 0)
|
||||
for _, _rule := range self.getSecurityRules(direction) {
|
||||
singleRules, err := _rule.SingleRules()
|
||||
//这里没必要拆分为单个单个的端口,到公有云那边适配
|
||||
rule, err := _rule.toRule()
|
||||
if err != nil {
|
||||
log.Errorf(err.Error())
|
||||
continue
|
||||
}
|
||||
rules = append(rules, singleRules...)
|
||||
rules = append(rules, *rule)
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user