Skip to content

Commit

Permalink
Fix balancer capture
Browse files Browse the repository at this point in the history
  • Loading branch information
kzaitsev committed Aug 7, 2024
1 parent beaa287 commit c0b6726
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions serverscom/loadbalancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,14 @@ func (l *loadBalancers) findLoadBalancerByName(ctx context.Context, clusterName
var currentLoadBalancer *cli.LoadBalancer

for _, loadBalancer := range loadBalancers {
if loadBalancer.Name == name {
balancer := loadBalancer

if balancer.Name == name {
if currentLoadBalancer != nil {
return nil, fmt.Errorf("found more than one load balancer with the same name: %s", name)
}

currentLoadBalancer = &loadBalancer
currentLoadBalancer = &balancer
}
}

Expand Down

0 comments on commit c0b6726

Please sign in to comment.