fix(api/edge_stacks): ensure edge stacks related endpoints list generation returns unique elements (#12101)

pull/12119/head
LP B 2024-08-20 10:20:03 +02:00 committed by GitHub
parent 054898f821
commit a39abe61c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
portainer "github.com/portainer/portainer/api" portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/dataservices"
"github.com/portainer/portainer/api/slicesx"
) )
var ErrEdgeGroupNotFound = errors.New("edge group was not found") var ErrEdgeGroupNotFound = errors.New("edge group was not found")
@ -32,7 +33,7 @@ func EdgeStackRelatedEndpoints(edgeGroupIDs []portainer.EdgeGroupID, endpoints [
edgeStackEndpoints = append(edgeStackEndpoints, EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups)...) edgeStackEndpoints = append(edgeStackEndpoints, EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups)...)
} }
return edgeStackEndpoints, nil return slicesx.Unique(edgeStackEndpoints), nil
} }
type EndpointRelationsConfig struct { type EndpointRelationsConfig struct {