fix(edgegroups): remove duplicated endpoints when updating an edge group EE-5679 (#9138)

pull/9143/head
andres-portainer 2023-06-30 18:39:56 -03:00 committed by GitHub
parent bc47061624
commit 8a432ebbf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/edge"
"github.com/portainer/portainer/api/internal/endpointutils" "github.com/portainer/portainer/api/internal/endpointutils"
"github.com/portainer/portainer/api/internal/slices" "github.com/portainer/portainer/api/internal/slices"
"github.com/portainer/portainer/api/internal/unique"
"github.com/asaskevich/govalidator" "github.com/asaskevich/govalidator"
) )
@ -125,7 +126,7 @@ func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request)
} }
newRelatedEndpoints := edge.EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups) newRelatedEndpoints := edge.EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups)
endpointsToUpdate := append(newRelatedEndpoints, oldRelatedEndpoints...) endpointsToUpdate := unique.Unique(append(newRelatedEndpoints, oldRelatedEndpoints...))
edgeJobs, err := tx.EdgeJob().ReadAll() edgeJobs, err := tx.EdgeJob().ReadAll()
if err != nil { if err != nil {