2020-05-25 06:10:02 +00:00
|
|
|
package migrator
|
|
|
|
|
2020-08-03 22:18:53 +00:00
|
|
|
import portainer "github.com/portainer/portainer/api"
|
|
|
|
|
2020-05-25 06:10:02 +00:00
|
|
|
func (m *Migrator) updateSettingsToDB24() error {
|
2020-07-24 23:14:46 +00:00
|
|
|
legacySettings, err := m.settingsService.Settings()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
legacySettings.AllowHostNamespaceForRegularUsers = true
|
2020-07-26 21:31:14 +00:00
|
|
|
legacySettings.AllowDeviceMappingForRegularUsers = true
|
2020-07-27 07:11:32 +00:00
|
|
|
legacySettings.AllowStackManagementForRegularUsers = true
|
2020-07-24 23:14:46 +00:00
|
|
|
|
|
|
|
return m.settingsService.UpdateSettings(legacySettings)
|
2020-05-25 06:10:02 +00:00
|
|
|
}
|
2020-08-03 22:18:53 +00:00
|
|
|
|
|
|
|
func (m *Migrator) updateStacksToDB24() error {
|
|
|
|
stacks, err := m.stackService.Stacks()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for idx := range stacks {
|
|
|
|
stack := &stacks[idx]
|
|
|
|
stack.Status = portainer.StackStatusActive
|
|
|
|
err := m.stackService.UpdateStack(stack.ID, stack)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|