Skip to content

Commit

Permalink
Merge pull request #281 from ioito/hotfix/qx-azure-div-zero
Browse files Browse the repository at this point in the history
fix(region): avoid div zero
  • Loading branch information
ioito authored May 15, 2023
2 parents 77babf2 + 5362e16 commit 3a7171b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/multicloud/azure/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ func (region *SRegion) CreateSecurityGroup(opts *cloudprovider.SecurityGroupCrea
}

sortRules := func(rules []cloudprovider.SecurityRule) []SecurityRules {
names := []string{}
securityRules := []SecurityRules{}
offset := (4096-100)/len(rules) - 1
names := []string{}
offset := (4096 - 100) / (len(rules) + 1) //avoid div zero
for i := 0; i < len(rules); i++ {
rules[i].Priority = 4096 - offset*i
rule := convertSecurityGroupRule(rules[i])
Expand Down

0 comments on commit 3a7171b

Please sign in to comment.