mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #623 in YUNIONIO/onecloud from ~QUXUAN/onecloud:hotfix/qx-secgroup-rule to release/2.1.0
* commit '0f78dd1ffcb8c4fef3fd42324e5adf22eb8e911e': 大部分公有云不需要将安全组拆分为单个单个的规则
This commit is contained in:
@@ -273,6 +273,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()
|
||||
|
||||
@@ -116,11 +116,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