Skip to content

Commit

Permalink
fix get security group name by external_ids (#1663)
Browse files Browse the repository at this point in the history
  • Loading branch information
gugulee authored Jul 4, 2022
1 parent 993ae20 commit 4616285
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ func (c *Controller) syncSgLogicalPort(key string) error {

func (c *Controller) getPortSg(port *ovnnb.LogicalSwitchPort) ([]string, error) {
var sgList []string
for _, value := range port.ExternalIDs {
if strings.HasPrefix(value, "associated_sg_") && strings.HasSuffix(value, "true") {
sgName := strings.ReplaceAll(strings.Split(value, "=")[0], "associated_sg_", "")
for key, value := range port.ExternalIDs {
if strings.HasPrefix(key, "associated_sg_") && value == "true" {
sgName := strings.ReplaceAll(key, "associated_sg_", "")
sgList = append(sgList, sgName)
}
}
Expand Down

0 comments on commit 4616285

Please sign in to comment.