mirror of
https://github.com/portainer/portainer.git
synced 2026-08-07 10:04:49 +00:00
fix(datastore): skip missing stacks in 2.44.0 source-interval migration [BE-13277] (#3323)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
portainer "github.com/portainer/portainer/api"
|
portainer "github.com/portainer/portainer/api"
|
||||||
|
"github.com/portainer/portainer/api/dataservices"
|
||||||
"github.com/portainer/portainer/api/dataservices/source"
|
"github.com/portainer/portainer/api/dataservices/source"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
@@ -38,6 +39,9 @@ func (m *Migrator) backfillSourceInterval_2_44_0() error {
|
|||||||
intervalByStack := make(map[portainer.StackID]string, len(referencedStackIDs))
|
intervalByStack := make(map[portainer.StackID]string, len(referencedStackIDs))
|
||||||
for stackID := range referencedStackIDs {
|
for stackID := range referencedStackIDs {
|
||||||
s, err := m.stackService.Read(stackID)
|
s, err := m.stackService.Read(stackID)
|
||||||
|
if dataservices.IsErrObjectNotFound(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to read stack %d: %w", stackID, err)
|
return fmt.Errorf("failed to read stack %d: %w", stackID, err)
|
||||||
}
|
}
|
||||||
@@ -107,6 +111,9 @@ func (m *Migrator) backfillSourceIntervalForGroup_2_44_0(tx portainer.Transactio
|
|||||||
|
|
||||||
func (m *Migrator) clearAutoUpdateInterval_2_44_0(tx portainer.Transaction, stackID portainer.StackID) error {
|
func (m *Migrator) clearAutoUpdateInterval_2_44_0(tx portainer.Transaction, stackID portainer.StackID) error {
|
||||||
s, err := m.stackService.Tx(tx).Read(stackID)
|
s, err := m.stackService.Tx(tx).Read(stackID)
|
||||||
|
if dataservices.IsErrObjectNotFound(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to read stack %d: %w", stackID, err)
|
return fmt.Errorf("failed to read stack %d: %w", stackID, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user