From 8a432ebbf866b9d819e27464812be5370ffe3d0f Mon Sep 17 00:00:00 2001 From: andres-portainer <91705312+andres-portainer@users.noreply.github.com> Date: Fri, 30 Jun 2023 18:39:56 -0300 Subject: [PATCH] fix(edgegroups): remove duplicated endpoints when updating an edge group EE-5679 (#9138) --- api/http/handler/edgegroups/edgegroup_update.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/http/handler/edgegroups/edgegroup_update.go b/api/http/handler/edgegroups/edgegroup_update.go index 1aac90591..ab1caf91b 100644 --- a/api/http/handler/edgegroups/edgegroup_update.go +++ b/api/http/handler/edgegroups/edgegroup_update.go @@ -11,6 +11,7 @@ import ( "github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/endpointutils" "github.com/portainer/portainer/api/internal/slices" + "github.com/portainer/portainer/api/internal/unique" "github.com/asaskevich/govalidator" ) @@ -125,7 +126,7 @@ func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request) } newRelatedEndpoints := edge.EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups) - endpointsToUpdate := append(newRelatedEndpoints, oldRelatedEndpoints...) + endpointsToUpdate := unique.Unique(append(newRelatedEndpoints, oldRelatedEndpoints...)) edgeJobs, err := tx.EdgeJob().ReadAll() if err != nil {