diff --git a/api/http/handler/edgegroups/edgegroup_delete.go b/api/http/handler/edgegroups/edgegroup_delete.go index 074be2bf7..beb82c167 100644 --- a/api/http/handler/edgegroups/edgegroup_delete.go +++ b/api/http/handler/edgegroups/edgegroup_delete.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -29,14 +28,9 @@ func (handler *Handler) edgeGroupDelete(w http.ResponseWriter, r *http.Request) return httperror.BadRequest("Invalid Edge group identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = deleteEdgeGroup(handler.DataStore, portainer.EdgeGroupID(edgeGroupID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return deleteEdgeGroup(tx, portainer.EdgeGroupID(edgeGroupID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return deleteEdgeGroup(tx, portainer.EdgeGroupID(edgeGroupID)) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/edgegroups/edgegroup_inspect.go b/api/http/handler/edgegroups/edgegroup_inspect.go index 533b46a3f..c17ac6b7c 100644 --- a/api/http/handler/edgegroups/edgegroup_inspect.go +++ b/api/http/handler/edgegroups/edgegroup_inspect.go @@ -5,7 +5,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" ) @@ -29,14 +28,10 @@ func (handler *Handler) edgeGroupInspect(w http.ResponseWriter, r *http.Request) } var edgeGroup *portainer.EdgeGroup - if featureflags.IsEnabled(portainer.FeatureNoTx) { - edgeGroup, err = getEdgeGroup(handler.DataStore, portainer.EdgeGroupID(edgeGroupID)) - } else { - err = handler.DataStore.ViewTx(func(tx dataservices.DataStoreTx) error { - edgeGroup, err = getEdgeGroup(tx, portainer.EdgeGroupID(edgeGroupID)) - return err - }) - } + err = handler.DataStore.ViewTx(func(tx dataservices.DataStoreTx) error { + edgeGroup, err = getEdgeGroup(tx, portainer.EdgeGroupID(edgeGroupID)) + return err + }) return txResponse(w, edgeGroup, err) } diff --git a/api/http/handler/edgegroups/edgegroup_list.go b/api/http/handler/edgegroups/edgegroup_list.go index a69b58121..237324f5c 100644 --- a/api/http/handler/edgegroups/edgegroup_list.go +++ b/api/http/handler/edgegroups/edgegroup_list.go @@ -7,7 +7,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/slices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" ) @@ -33,14 +32,10 @@ func (handler *Handler) edgeGroupList(w http.ResponseWriter, r *http.Request) *h var decoratedEdgeGroups []decoratedEdgeGroup var err error - if featureflags.IsEnabled(portainer.FeatureNoTx) { - decoratedEdgeGroups, err = getEdgeGroupList(handler.DataStore) - } else { - err = handler.DataStore.ViewTx(func(tx dataservices.DataStoreTx) error { - decoratedEdgeGroups, err = getEdgeGroupList(tx) - return err - }) - } + err = handler.DataStore.ViewTx(func(tx dataservices.DataStoreTx) error { + decoratedEdgeGroups, err = getEdgeGroupList(tx) + return err + }) return txResponse(w, decoratedEdgeGroups, err) } diff --git a/api/http/handler/edgejobs/edgejob_create.go b/api/http/handler/edgejobs/edgejob_create.go index c8d80ccf1..73135dea1 100644 --- a/api/http/handler/edgejobs/edgejob_create.go +++ b/api/http/handler/edgejobs/edgejob_create.go @@ -12,7 +12,6 @@ import ( "github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/endpointutils" "github.com/portainer/portainer/api/internal/maps" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" @@ -92,15 +91,11 @@ func (handler *Handler) createEdgeJobFromFileContent(w http.ResponseWriter, r *h } var edgeJob *portainer.EdgeJob - if featureflags.IsEnabled(portainer.FeatureNoTx) { - edgeJob, err = handler.createEdgeJob(handler.DataStore, &payload.edgeJobBasePayload, []byte(payload.FileContent)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - edgeJob, err = handler.createEdgeJob(tx, &payload.edgeJobBasePayload, []byte(payload.FileContent)) + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + edgeJob, err = handler.createEdgeJob(tx, &payload.edgeJobBasePayload, []byte(payload.FileContent)) - return err - }) - } + return err + }) return txResponse(w, edgeJob, err) } @@ -201,15 +196,11 @@ func (handler *Handler) createEdgeJobFromFile(w http.ResponseWriter, r *http.Req } var edgeJob *portainer.EdgeJob - if featureflags.IsEnabled(portainer.FeatureNoTx) { - edgeJob, err = handler.createEdgeJob(handler.DataStore, &payload.edgeJobBasePayload, payload.File) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - edgeJob, err = handler.createEdgeJob(tx, &payload.edgeJobBasePayload, payload.File) + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + edgeJob, err = handler.createEdgeJob(tx, &payload.edgeJobBasePayload, payload.File) - return err - }) - } + return err + }) return txResponse(w, edgeJob, err) } diff --git a/api/http/handler/edgejobs/edgejob_delete.go b/api/http/handler/edgejobs/edgejob_delete.go index 8f47a6977..355562894 100644 --- a/api/http/handler/edgejobs/edgejob_delete.go +++ b/api/http/handler/edgejobs/edgejob_delete.go @@ -9,7 +9,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/maps" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -34,14 +33,9 @@ func (handler *Handler) edgeJobDelete(w http.ResponseWriter, r *http.Request) *h return httperror.BadRequest("Invalid Edge job identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.deleteEdgeJob(handler.DataStore, portainer.EdgeJobID(edgeJobID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.deleteEdgeJob(tx, portainer.EdgeJobID(edgeJobID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.deleteEdgeJob(tx, portainer.EdgeJobID(edgeJobID)) + }) if err != nil { var handlerError *httperror.HandlerError if errors.As(err, &handlerError) { diff --git a/api/http/handler/edgejobs/edgejob_tasklogs_clear.go b/api/http/handler/edgejobs/edgejob_tasklogs_clear.go index 0e137e576..8d712afd2 100644 --- a/api/http/handler/edgejobs/edgejob_tasklogs_clear.go +++ b/api/http/handler/edgejobs/edgejob_tasklogs_clear.go @@ -9,7 +9,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/slices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -54,27 +53,15 @@ func (handler *Handler) edgeJobTasksClear(w http.ResponseWriter, r *http.Request } } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { updateEdgeJobFn := func(edgeJob *portainer.EdgeJob, endpointID portainer.EndpointID, endpointsFromGroups []portainer.EndpointID) error { - return handler.DataStore.EdgeJob().UpdateEdgeJobFunc(edgeJob.ID, func(j *portainer.EdgeJob) { - mutationFn(j, endpointID, endpointsFromGroups) - }) + mutationFn(edgeJob, endpointID, endpointsFromGroups) + + return tx.EdgeJob().Update(edgeJob.ID, edgeJob) } - err = handler.clearEdgeJobTaskLogs(handler.DataStore, portainer.EdgeJobID(edgeJobID), portainer.EndpointID(taskID), updateEdgeJobFn) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - updateEdgeJobFn := func(edgeJob *portainer.EdgeJob, endpointID portainer.EndpointID, endpointsFromGroups []portainer.EndpointID) error { - mutationFn(edgeJob, endpointID, endpointsFromGroups) - - return tx.EdgeJob().Update(edgeJob.ID, edgeJob) - } - - return handler.clearEdgeJobTaskLogs(tx, portainer.EdgeJobID(edgeJobID), portainer.EndpointID(taskID), updateEdgeJobFn) - }) - } - + return handler.clearEdgeJobTaskLogs(tx, portainer.EdgeJobID(edgeJobID), portainer.EndpointID(taskID), updateEdgeJobFn) + }) if err != nil { var handlerError *httperror.HandlerError if errors.As(err, &handlerError) { diff --git a/api/http/handler/edgejobs/edgejob_tasks_list.go b/api/http/handler/edgejobs/edgejob_tasks_list.go index c7ba5eafb..f18ca6979 100644 --- a/api/http/handler/edgejobs/edgejob_tasks_list.go +++ b/api/http/handler/edgejobs/edgejob_tasks_list.go @@ -8,7 +8,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/maps" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" ) @@ -39,14 +38,10 @@ func (handler *Handler) edgeJobTasksList(w http.ResponseWriter, r *http.Request) } var tasks []taskContainer - if featureflags.IsEnabled(portainer.FeatureNoTx) { - tasks, err = listEdgeJobTasks(handler.DataStore, portainer.EdgeJobID(edgeJobID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - tasks, err = listEdgeJobTasks(tx, portainer.EdgeJobID(edgeJobID)) - return err - }) - } + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + tasks, err = listEdgeJobTasks(tx, portainer.EdgeJobID(edgeJobID)) + return err + }) return txResponse(w, tasks, err) } diff --git a/api/http/handler/edgejobs/edgejob_update.go b/api/http/handler/edgejobs/edgejob_update.go index 537f77ae7..43e9e0b88 100644 --- a/api/http/handler/edgejobs/edgejob_update.go +++ b/api/http/handler/edgejobs/edgejob_update.go @@ -11,7 +11,6 @@ import ( "github.com/portainer/portainer/api/internal/endpointutils" "github.com/portainer/portainer/api/internal/maps" "github.com/portainer/portainer/api/internal/slices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" @@ -63,14 +62,10 @@ func (handler *Handler) edgeJobUpdate(w http.ResponseWriter, r *http.Request) *h } var edgeJob *portainer.EdgeJob - if featureflags.IsEnabled(portainer.FeatureNoTx) { - edgeJob, err = handler.updateEdgeJob(handler.DataStore, portainer.EdgeJobID(edgeJobID), payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - edgeJob, err = handler.updateEdgeJob(tx, portainer.EdgeJobID(edgeJobID), payload) - return err - }) - } + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + edgeJob, err = handler.updateEdgeJob(tx, portainer.EdgeJobID(edgeJobID), payload) + return err + }) return txResponse(w, edgeJob, err) } diff --git a/api/http/handler/edgestacks/edgestack_create.go b/api/http/handler/edgestacks/edgestack_create.go index c0512dca5..a683a9d70 100644 --- a/api/http/handler/edgestacks/edgestack_create.go +++ b/api/http/handler/edgestacks/edgestack_create.go @@ -7,7 +7,6 @@ import ( "github.com/portainer/portainer/api/dataservices" httperrors "github.com/portainer/portainer/api/http/errors" "github.com/portainer/portainer/api/http/security" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -26,14 +25,10 @@ func (handler *Handler) edgeStackCreate(w http.ResponseWriter, r *http.Request) } var edgeStack *portainer.EdgeStack - if featureflags.IsEnabled(portainer.FeatureNoTx) { - edgeStack, err = handler.createSwarmStack(handler.DataStore, method, dryrun, tokenData.ID, r) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - edgeStack, err = handler.createSwarmStack(tx, method, dryrun, tokenData.ID, r) - return err - }) - } + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + edgeStack, err = handler.createSwarmStack(tx, method, dryrun, tokenData.ID, r) + return err + }) if err != nil { switch { case httperrors.IsInvalidPayloadError(err): diff --git a/api/http/handler/edgestacks/edgestack_delete.go b/api/http/handler/edgestacks/edgestack_delete.go index 68de13140..17d5f4e2d 100644 --- a/api/http/handler/edgestacks/edgestack_delete.go +++ b/api/http/handler/edgestacks/edgestack_delete.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -30,14 +29,9 @@ func (handler *Handler) edgeStackDelete(w http.ResponseWriter, r *http.Request) return httperror.BadRequest("Invalid edge stack identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.deleteEdgeStack(handler.DataStore, portainer.EdgeStackID(edgeStackID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.deleteEdgeStack(tx, portainer.EdgeStackID(edgeStackID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.deleteEdgeStack(tx, portainer.EdgeStackID(edgeStackID)) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/edgestacks/edgestack_status_delete.go b/api/http/handler/edgestacks/edgestack_status_delete.go index fe09db311..e06861a36 100644 --- a/api/http/handler/edgestacks/edgestack_status_delete.go +++ b/api/http/handler/edgestacks/edgestack_status_delete.go @@ -8,7 +8,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/http/middlewares" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -45,14 +44,10 @@ func (handler *Handler) edgeStackStatusDelete(w http.ResponseWriter, r *http.Req } var stack *portainer.EdgeStack - if featureflags.IsEnabled(portainer.FeatureNoTx) { - stack, err = handler.deleteEdgeStackStatus(handler.DataStore, portainer.EdgeStackID(stackID), endpoint) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - stack, err = handler.deleteEdgeStackStatus(tx, portainer.EdgeStackID(stackID), endpoint) - return err - }) - } + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + stack, err = handler.deleteEdgeStackStatus(tx, portainer.EdgeStackID(stackID), endpoint) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/edgestacks/edgestack_status_update.go b/api/http/handler/edgestacks/edgestack_status_update.go index f8d3103ca..53fdef1df 100644 --- a/api/http/handler/edgestacks/edgestack_status_update.go +++ b/api/http/handler/edgestacks/edgestack_status_update.go @@ -7,7 +7,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -70,15 +69,10 @@ func (handler *Handler) edgeStackStatusUpdate(w http.ResponseWriter, r *http.Req } var stack *portainer.EdgeStack - if featureflags.IsEnabled(portainer.FeatureNoTx) { - stack, err = handler.updateEdgeStackStatus(handler.DataStore, r, portainer.EdgeStackID(stackID), payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - stack, err = handler.updateEdgeStackStatus(tx, r, portainer.EdgeStackID(stackID), payload) - return err - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + stack, err = handler.updateEdgeStackStatus(tx, r, portainer.EdgeStackID(stackID), payload) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { @@ -130,22 +124,11 @@ func (handler *Handler) updateEdgeStackStatus(tx dataservices.DataStoreTx, r *ht Time: payload.Time, } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = tx.EdgeStack().UpdateEdgeStackFunc(stackID, func(edgeStack *portainer.EdgeStack) { - updateEnvStatus(payload.EndpointID, edgeStack, deploymentStatus) + updateEnvStatus(payload.EndpointID, stack, deploymentStatus) - stack = edgeStack - }) - if err != nil { - return nil, handler.handlerDBErr(err, "Unable to persist the stack changes inside the database") - } - } else { - updateEnvStatus(payload.EndpointID, stack, deploymentStatus) - - err = tx.EdgeStack().UpdateEdgeStack(stackID, stack) - if err != nil { - return nil, handler.handlerDBErr(err, "Unable to persist the stack changes inside the database") - } + err = tx.EdgeStack().UpdateEdgeStack(stackID, stack) + if err != nil { + return nil, handler.handlerDBErr(err, "Unable to persist the stack changes inside the database") } return stack, nil diff --git a/api/http/handler/edgestacks/edgestack_update.go b/api/http/handler/edgestacks/edgestack_update.go index afb510caa..6b3efc9d9 100644 --- a/api/http/handler/edgestacks/edgestack_update.go +++ b/api/http/handler/edgestacks/edgestack_update.go @@ -8,7 +8,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/edge" "github.com/portainer/portainer/api/internal/set" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -65,15 +64,10 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request) } var stack *portainer.EdgeStack - if featureflags.IsEnabled(portainer.FeatureNoTx) { - stack, err = handler.updateEdgeStack(handler.DataStore, portainer.EdgeStackID(stackID), payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - stack, err = handler.updateEdgeStack(tx, portainer.EdgeStackID(stackID), payload) - return err - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + stack, err = handler.updateEdgeStack(tx, portainer.EdgeStackID(stackID), payload) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/endpointedge/endpointedge_job_logs.go b/api/http/handler/endpointedge/endpointedge_job_logs.go index 50389d96f..90dba680a 100644 --- a/api/http/handler/endpointedge/endpointedge_job_logs.go +++ b/api/http/handler/endpointedge/endpointedge_job_logs.go @@ -8,7 +8,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/http/middlewares" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -56,14 +55,9 @@ func (handler *Handler) endpointEdgeJobsLogs(w http.ResponseWriter, r *http.Requ return httperror.BadRequest("Invalid request payload", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.getEdgeJobLobs(handler.DataStore, endpoint.ID, portainer.EdgeJobID(edgeJobID), payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.getEdgeJobLobs(tx, endpoint.ID, portainer.EdgeJobID(edgeJobID), payload) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.getEdgeJobLobs(tx, endpoint.ID, portainer.EdgeJobID(edgeJobID), payload) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/endpointedge/endpointedge_status_inspect.go b/api/http/handler/endpointedge/endpointedge_status_inspect.go index fc372c360..a6f8e21fc 100644 --- a/api/http/handler/endpointedge/endpointedge_status_inspect.go +++ b/api/http/handler/endpointedge/endpointedge_status_inspect.go @@ -16,7 +16,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/edge/cache" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -106,15 +105,10 @@ func (handler *Handler) endpointEdgeStatusInspect(w http.ResponseWriter, r *http } var statusResponse *endpointEdgeStatusInspectResponse - if featureflags.IsEnabled(portainer.FeatureNoTx) { - statusResponse, err = handler.inspectStatus(handler.DataStore, r, portainer.EndpointID(endpointID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - statusResponse, err = handler.inspectStatus(tx, r, portainer.EndpointID(endpointID)) - return err - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + statusResponse, err = handler.inspectStatus(tx, r, portainer.EndpointID(endpointID)) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/endpointgroups/endpointgroup_create.go b/api/http/handler/endpointgroups/endpointgroup_create.go index 4f3eec5bb..e5538a738 100644 --- a/api/http/handler/endpointgroups/endpointgroup_create.go +++ b/api/http/handler/endpointgroups/endpointgroup_create.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -58,15 +57,10 @@ func (handler *Handler) endpointGroupCreate(w http.ResponseWriter, r *http.Reque } var endpointGroup *portainer.EndpointGroup - if featureflags.IsEnabled(portainer.FeatureNoTx) { - endpointGroup, err = handler.createEndpointGroup(handler.DataStore, payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - endpointGroup, err = handler.createEndpointGroup(tx, payload) - return err - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + endpointGroup, err = handler.createEndpointGroup(tx, payload) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { @@ -119,20 +113,6 @@ func (handler *Handler) createEndpointGroup(tx dataservices.DataStoreTx, payload } for _, tagID := range endpointGroup.TagIDs { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = tx.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) { - tag.EndpointGroups[endpointGroup.ID] = true - }) - - if tx.IsErrObjectNotFound(err) { - return nil, httperror.InternalServerError("Unable to find a tag inside the database", err) - } else if err != nil { - return nil, httperror.InternalServerError("Unable to persist tag changes inside the database", err) - } - - continue - } - tag, err := tx.Tag().Read(tagID) if err != nil { return nil, httperror.InternalServerError("Unable to find a tag inside the database", err) diff --git a/api/http/handler/endpointgroups/endpointgroup_delete.go b/api/http/handler/endpointgroups/endpointgroup_delete.go index b33a142f7..f49c9d0dd 100644 --- a/api/http/handler/endpointgroups/endpointgroup_delete.go +++ b/api/http/handler/endpointgroups/endpointgroup_delete.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -35,14 +34,9 @@ func (handler *Handler) endpointGroupDelete(w http.ResponseWriter, r *http.Reque return httperror.Forbidden("Unable to remove the default 'Unassigned' group", errors.New("Cannot remove the default environment group")) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.deleteEndpointGroup(handler.DataStore, portainer.EndpointGroupID(endpointGroupID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.deleteEndpointGroup(tx, portainer.EndpointGroupID(endpointGroupID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.deleteEndpointGroup(tx, portainer.EndpointGroupID(endpointGroupID)) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { @@ -89,20 +83,6 @@ func (handler *Handler) deleteEndpointGroup(tx dataservices.DataStoreTx, endpoin } for _, tagID := range endpointGroup.TagIDs { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = tx.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) { - delete(tag.EndpointGroups, endpointGroup.ID) - }) - - if tx.IsErrObjectNotFound(err) { - return httperror.InternalServerError("Unable to find a tag inside the database", err) - } else if err != nil { - return httperror.InternalServerError("Unable to persist tag changes inside the database", err) - } - - continue - } - tag, err := tx.Tag().Read(tagID) if tx.IsErrObjectNotFound(err) { return httperror.InternalServerError("Unable to find a tag inside the database", err) diff --git a/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go b/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go index 61588a93f..439d4afff 100644 --- a/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go +++ b/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -37,14 +36,9 @@ func (handler *Handler) endpointGroupAddEndpoint(w http.ResponseWriter, r *http. return httperror.BadRequest("Invalid environment identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.addEndpoint(handler.DataStore, portainer.EndpointGroupID(endpointGroupID), portainer.EndpointID(endpointID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.addEndpoint(tx, portainer.EndpointGroupID(endpointGroupID), portainer.EndpointID(endpointID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.addEndpoint(tx, portainer.EndpointGroupID(endpointGroupID), portainer.EndpointID(endpointID)) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go b/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go index f277df70d..d57592093 100644 --- a/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go +++ b/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -36,14 +35,9 @@ func (handler *Handler) endpointGroupDeleteEndpoint(w http.ResponseWriter, r *ht return httperror.BadRequest("Invalid environment identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.removeEndpoint(handler.DataStore, portainer.EndpointGroupID(endpointGroupID), portainer.EndpointID(endpointID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.removeEndpoint(tx, portainer.EndpointGroupID(endpointGroupID), portainer.EndpointID(endpointID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.removeEndpoint(tx, portainer.EndpointGroupID(endpointGroupID), portainer.EndpointID(endpointID)) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/endpointgroups/endpointgroup_update.go b/api/http/handler/endpointgroups/endpointgroup_update.go index 16f7bab21..ae007b46e 100644 --- a/api/http/handler/endpointgroups/endpointgroup_update.go +++ b/api/http/handler/endpointgroups/endpointgroup_update.go @@ -9,7 +9,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/http/utils" "github.com/portainer/portainer/api/internal/tag" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -60,15 +59,10 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque } var endpointGroup *portainer.EndpointGroup - if featureflags.IsEnabled(portainer.FeatureNoTx) { - endpointGroup, err = handler.updateEndpointGroup(handler.DataStore, portainer.EndpointGroupID(endpointGroupID), payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - endpointGroup, err = handler.updateEndpointGroup(tx, portainer.EndpointGroupID(endpointGroupID), payload) - return err - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + endpointGroup, err = handler.updateEndpointGroup(tx, portainer.EndpointGroupID(endpointGroupID), payload) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { @@ -109,20 +103,6 @@ func (handler *Handler) updateEndpointGroup(tx dataservices.DataStoreTx, endpoin removeTags := tag.Difference(endpointGroupTagSet, payloadTagSet) for tagID := range removeTags { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = tx.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) { - delete(tag.EndpointGroups, endpointGroup.ID) - }) - - if tx.IsErrObjectNotFound(err) { - return nil, httperror.InternalServerError("Unable to find a tag inside the database", err) - } else if err != nil { - return nil, httperror.InternalServerError("Unable to persist tag changes inside the database", err) - } - - continue - } - tag, err := tx.Tag().Read(tagID) if err != nil { return nil, httperror.InternalServerError("Unable to find a tag inside the database", err) @@ -138,20 +118,6 @@ func (handler *Handler) updateEndpointGroup(tx dataservices.DataStoreTx, endpoin endpointGroup.TagIDs = payload.TagIDs for _, tagID := range payload.TagIDs { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = tx.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) { - tag.EndpointGroups[endpointGroup.ID] = true - }) - - if tx.IsErrObjectNotFound(err) { - return nil, httperror.InternalServerError("Unable to find a tag inside the database", err) - } else if err != nil { - return nil, httperror.InternalServerError("Unable to persist tag changes inside the database", err) - } - - continue - } - tag, err := tx.Tag().Read(tagID) if err != nil { return nil, httperror.InternalServerError("Unable to find a tag inside the database", err) diff --git a/api/http/handler/endpoints/endpoint_delete.go b/api/http/handler/endpoints/endpoint_delete.go index 2cd0b17ae..878ed944a 100644 --- a/api/http/handler/endpoints/endpoint_delete.go +++ b/api/http/handler/endpoints/endpoint_delete.go @@ -9,7 +9,6 @@ import ( "github.com/portainer/portainer/api/dataservices" httperrors "github.com/portainer/portainer/api/http/errors" "github.com/portainer/portainer/api/internal/endpointutils" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -47,14 +46,9 @@ func (handler *Handler) endpointDelete(w http.ResponseWriter, r *http.Request) * return httperror.Forbidden(httperrors.ErrNotAvailableInDemo.Error(), httperrors.ErrNotAvailableInDemo) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.deleteEndpoint(handler.DataStore, portainer.EndpointID(endpointID), deleteCluster) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.deleteEndpoint(tx, portainer.EndpointID(endpointID), deleteCluster) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.deleteEndpoint(tx, portainer.EndpointID(endpointID), deleteCluster) + }) if err != nil { var handlerError *httperror.HandlerError if errors.As(err, &handlerError) { @@ -103,17 +97,11 @@ func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID p } for _, tagID := range endpoint.TagIDs { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) { - delete(tag.Endpoints, endpoint.ID) - }) - } else { - var tag *portainer.Tag - tag, err = tx.Tag().Read(tagID) - if err == nil { - delete(tag.Endpoints, endpoint.ID) - err = tx.Tag().Update(tagID, tag) - } + var tag *portainer.Tag + tag, err = tx.Tag().Read(tagID) + if err == nil { + delete(tag.Endpoints, endpoint.ID) + err = tx.Tag().Update(tagID, tag) } if handler.DataStore.IsErrObjectNotFound(err) { @@ -129,14 +117,8 @@ func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID p } for _, edgeGroup := range edgeGroups { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.DataStore.EdgeGroup().UpdateEdgeGroupFunc(edgeGroup.ID, func(g *portainer.EdgeGroup) { - g.Endpoints = removeElement(g.Endpoints, endpoint.ID) - }) - } else { - edgeGroup.Endpoints = removeElement(edgeGroup.Endpoints, endpoint.ID) - tx.EdgeGroup().Update(edgeGroup.ID, &edgeGroup) - } + edgeGroup.Endpoints = removeElement(edgeGroup.Endpoints, endpoint.ID) + tx.EdgeGroup().Update(edgeGroup.ID, &edgeGroup) if err != nil { log.Warn().Err(err).Msgf("Unable to update edge group") @@ -184,15 +166,9 @@ func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID p for idx := range edgeJobs { edgeJob := &edgeJobs[idx] if _, ok := edgeJob.Endpoints[endpoint.ID]; ok { - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = tx.EdgeJob().UpdateEdgeJobFunc(edgeJob.ID, func(j *portainer.EdgeJob) { - delete(j.Endpoints, endpoint.ID) - }) - } else { - delete(edgeJob.Endpoints, endpoint.ID) - err = tx.EdgeJob().Update(edgeJob.ID, edgeJob) - } + delete(edgeJob.Endpoints, endpoint.ID) + err = tx.EdgeJob().Update(edgeJob.ID, edgeJob) if err != nil { log.Warn().Err(err).Msgf("Unable to update edge job") } diff --git a/api/http/handler/endpoints/endpoint_registries_list.go b/api/http/handler/endpoints/endpoint_registries_list.go index 86140a81f..039693d17 100644 --- a/api/http/handler/endpoints/endpoint_registries_list.go +++ b/api/http/handler/endpoints/endpoint_registries_list.go @@ -7,7 +7,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/http/security" "github.com/portainer/portainer/api/internal/endpointutils" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -35,14 +34,10 @@ func (handler *Handler) endpointRegistriesList(w http.ResponseWriter, r *http.Re } var registries []portainer.Registry - if featureflags.IsEnabled(portainer.FeatureNoTx) { - registries, err = handler.listRegistries(handler.DataStore, r, portainer.EndpointID(endpointID)) - } else { - err = handler.DataStore.ViewTx(func(tx dataservices.DataStoreTx) error { - registries, err = handler.listRegistries(tx, r, portainer.EndpointID(endpointID)) - return err - }) - } + err = handler.DataStore.ViewTx(func(tx dataservices.DataStoreTx) error { + registries, err = handler.listRegistries(tx, r, portainer.EndpointID(endpointID)) + return err + }) if err != nil { var httpErr *httperror.HandlerError diff --git a/api/http/handler/endpoints/endpoint_registry_access.go b/api/http/handler/endpoints/endpoint_registry_access.go index cd049caa2..ce6a62d15 100644 --- a/api/http/handler/endpoints/endpoint_registry_access.go +++ b/api/http/handler/endpoints/endpoint_registry_access.go @@ -7,7 +7,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/http/security" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -51,14 +50,9 @@ func (handler *Handler) endpointRegistryAccess(w http.ResponseWriter, r *http.Re return httperror.BadRequest("Invalid registry identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = handler.updateRegistryAccess(handler.DataStore, r, portainer.EndpointID(endpointID), portainer.RegistryID(registryID)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return handler.updateRegistryAccess(tx, r, portainer.EndpointID(endpointID), portainer.RegistryID(registryID)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return handler.updateRegistryAccess(tx, r, portainer.EndpointID(endpointID), portainer.RegistryID(registryID)) + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/settings/settings_update.go b/api/http/handler/settings/settings_update.go index e31d01f4f..51f1f8e09 100644 --- a/api/http/handler/settings/settings_update.go +++ b/api/http/handler/settings/settings_update.go @@ -9,7 +9,6 @@ import ( "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/filesystem" "github.com/portainer/portainer/api/internal/edge" - "github.com/portainer/portainer/pkg/featureflags" "github.com/portainer/portainer/pkg/libhelm" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" @@ -120,15 +119,10 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) * } var settings *portainer.Settings - if featureflags.IsEnabled(portainer.FeatureNoTx) { - settings, err = handler.updateSettings(handler.DataStore, payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - settings, err = handler.updateSettings(tx, payload) - return err - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + settings, err = handler.updateSettings(tx, payload) + return err + }) if err != nil { var httpErr *httperror.HandlerError if errors.As(err, &httpErr) { diff --git a/api/http/handler/tags/tag_create.go b/api/http/handler/tags/tag_create.go index acb01ad50..1bb4212f3 100644 --- a/api/http/handler/tags/tag_create.go +++ b/api/http/handler/tags/tag_create.go @@ -6,7 +6,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" @@ -47,14 +46,10 @@ func (handler *Handler) tagCreate(w http.ResponseWriter, r *http.Request) *httpe } var tag *portainer.Tag - if featureflags.IsEnabled(portainer.FeatureNoTx) { - tag, err = createTag(handler.DataStore, payload) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - tag, err = createTag(tx, payload) - return err - }) - } + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + tag, err = createTag(tx, payload) + return err + }) return txResponse(w, tag, err) } diff --git a/api/http/handler/tags/tag_delete.go b/api/http/handler/tags/tag_delete.go index 501de3cc3..378502f5e 100644 --- a/api/http/handler/tags/tag_delete.go +++ b/api/http/handler/tags/tag_delete.go @@ -7,7 +7,6 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/internal/edge" - "github.com/portainer/portainer/pkg/featureflags" httperror "github.com/portainer/portainer/pkg/libhttp/error" "github.com/portainer/portainer/pkg/libhttp/request" "github.com/portainer/portainer/pkg/libhttp/response" @@ -33,14 +32,9 @@ func (handler *Handler) tagDelete(w http.ResponseWriter, r *http.Request) *httpe return httperror.BadRequest("Invalid tag identifier route variable", err) } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - err = deleteTag(handler.DataStore, portainer.TagID(id)) - } else { - err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - return deleteTag(tx, portainer.TagID(id)) - }) - } - + err = handler.DataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + return deleteTag(tx, portainer.TagID(id)) + }) if err != nil { var handlerError *httperror.HandlerError if errors.As(err, &handlerError) { @@ -111,23 +105,12 @@ func deleteTag(tx dataservices.DataStoreTx, tagID portainer.TagID) error { } } - if featureflags.IsEnabled(portainer.FeatureNoTx) { - for _, edgeGroup := range edgeGroups { - err = tx.EdgeGroup().UpdateEdgeGroupFunc(edgeGroup.ID, func(g *portainer.EdgeGroup) { - g.TagIDs = removeElement(g.TagIDs, tagID) - }) - if err != nil { - return httperror.InternalServerError("Unable to update edge group", err) - } - } - } else { - for _, edgeGroup := range edgeGroups { - edgeGroup.TagIDs = removeElement(edgeGroup.TagIDs, tagID) + for _, edgeGroup := range edgeGroups { + edgeGroup.TagIDs = removeElement(edgeGroup.TagIDs, tagID) - err = tx.EdgeGroup().Update(edgeGroup.ID, &edgeGroup) - if err != nil { - return httperror.InternalServerError("Unable to update edge group", err) - } + err = tx.EdgeGroup().Update(edgeGroup.ID, &edgeGroup) + if err != nil { + return httperror.InternalServerError("Unable to update edge group", err) } } diff --git a/api/internal/snapshot/snapshot.go b/api/internal/snapshot/snapshot.go index dc429b144..3f509353d 100644 --- a/api/internal/snapshot/snapshot.go +++ b/api/internal/snapshot/snapshot.go @@ -13,7 +13,6 @@ import ( "github.com/portainer/portainer/api/http/utils" "github.com/portainer/portainer/api/internal/authorization" "github.com/portainer/portainer/api/internal/endpointutils" - "github.com/portainer/portainer/pkg/featureflags" "github.com/rs/zerolog/log" ) @@ -263,14 +262,10 @@ func (service *Service) snapshotEndpoints() error { snapshotError := service.SnapshotEndpoint(&endpoint) - if featureflags.IsEnabled(portainer.FeatureNoTx) { - updateEndpointStatus(service.dataStore, &endpoint, snapshotError) - } else { - service.dataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { - updateEndpointStatus(tx, &endpoint, snapshotError) - return nil - }) - } + service.dataStore.UpdateTx(func(tx dataservices.DataStoreTx) error { + updateEndpointStatus(tx, &endpoint, snapshotError) + return nil + }) } return nil diff --git a/api/portainer.go b/api/portainer.go index eb3640758..4e2880aa0 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -1616,13 +1616,11 @@ const ( // List of supported features const ( - FeatureFdo = "fdo" - FeatureNoTx = "noTx" + FeatureFdo = "fdo" ) var SupportedFeatureFlags = []featureflags.Feature{ FeatureFdo, - FeatureNoTx, } const (