2018-06-19 11:15:10 +00:00
|
|
|
package migrator
|
2018-05-19 14:25:11 +00:00
|
|
|
|
2019-03-21 01:20:14 +00:00
|
|
|
import "github.com/portainer/portainer/api"
|
2018-05-19 14:25:11 +00:00
|
|
|
|
|
|
|
func (m *Migrator) updateEndpointsToVersion11() error {
|
2018-06-19 11:15:10 +00:00
|
|
|
legacyEndpoints, err := m.endpointService.Endpoints()
|
2018-05-19 14:25:11 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, endpoint := range legacyEndpoints {
|
|
|
|
if endpoint.Type == portainer.AgentOnDockerEnvironment {
|
|
|
|
endpoint.TLSConfig.TLS = true
|
|
|
|
endpoint.TLSConfig.TLSSkipVerify = true
|
|
|
|
} else {
|
|
|
|
if endpoint.TLSConfig.TLSSkipVerify && !endpoint.TLSConfig.TLS {
|
|
|
|
endpoint.TLSConfig.TLSSkipVerify = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-19 11:15:10 +00:00
|
|
|
err = m.endpointService.UpdateEndpoint(endpoint.ID, &endpoint)
|
2018-05-19 14:25:11 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|