Skip to content

Commit 3a7171b

Browse files
authored
Merge pull request #281 from ioito/hotfix/qx-azure-div-zero
fix(region): avoid div zero
2 parents 77babf2 + 5362e16 commit 3a7171b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/multicloud/azure/securitygroup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ func (region *SRegion) CreateSecurityGroup(opts *cloudprovider.SecurityGroupCrea
306306
}
307307

308308
sortRules := func(rules []cloudprovider.SecurityRule) []SecurityRules {
309-
names := []string{}
310309
securityRules := []SecurityRules{}
311-
offset := (4096-100)/len(rules) - 1
310+
names := []string{}
311+
offset := (4096 - 100) / (len(rules) + 1) //avoid div zero
312312
for i := 0; i < len(rules); i++ {
313313
rules[i].Priority = 4096 - offset*i
314314
rule := convertSecurityGroupRule(rules[i])

0 commit comments

Comments
 (0)