mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(edge/update): remote update structure [EE-4040] (#7553)
This commit is contained in:
parent
dd1662c8b8
commit
6c4c958bf0
61 changed files with 1952 additions and 96 deletions
21
api/http/handler/edgeupdateschedules/utils.go
Normal file
21
api/http/handler/edgeupdateschedules/utils.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package edgeupdateschedules
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/portainer/portainer/api/edgetypes"
|
||||
)
|
||||
|
||||
func (handler *Handler) validateUniqueName(name string, id edgetypes.UpdateScheduleID) error {
|
||||
list, err := handler.dataStore.EdgeUpdateSchedule().List()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "Unable to list edge update schedules")
|
||||
}
|
||||
|
||||
for _, schedule := range list {
|
||||
if id != schedule.ID && schedule.Name == name {
|
||||
return errors.New("Edge update schedule name already in use")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue