|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
package migrator
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
|
|
|
"github.com/portainer/portainer/api/bolt/errors"
|
|
|
|
|
"github.com/portainer/portainer/api/internal/stackutils"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (m *Migrator) updateStackResourceControlToDB27() error {
|
|
|
|
@ -18,16 +18,17 @@ func (m *Migrator) updateStackResourceControlToDB27() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stackName := resource.ResourceID
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stack, err := m.stackService.StackByName(stackName)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if err == errors.ErrObjectNotFound {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource.ResourceID = fmt.Sprintf("%d_%s", stack.EndpointID, stack.Name)
|
|
|
|
|
resource.ResourceID = stackutils.ResourceControlID(stack.EndpointID, stack.Name)
|
|
|
|
|
|
|
|
|
|
err = m.resourceControlService.UpdateResourceControl(resource.ID, &resource)
|
|
|
|
|
if err != nil {
|
|
|
|
|