Fail if we find multiple sgs with same name

This commit is contained in:
Ole Markus With 2020-08-26 13:41:15 +02:00
parent 14a6f92f53
commit 5cb63fb788
1 changed files with 4 additions and 1 deletions

View File

@ -497,9 +497,12 @@ func (b *FirewallModelBuilder) getExistingRules(sgMap map[string]*openstacktasks
if err != nil {
return err
}
if len(sgs) != 1 {
if len(sgs) == 0 {
continue
}
if len(sgs) > 1 {
return fmt.Errorf("Found multiple security groups with the same name: %v", sgName)
}
sg := sgs[0]
sgt.Name = fi.String(sg.Name)
sgIdMap[sg.ID] = sgt