Correctly handle migrations to a VHD setup
This commit is contained in:
committed by
DaneEveritt
parent
265f8a6b39
commit
d8a7bf2dde
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"emperror.dev/errors"
|
||||
@@ -32,7 +31,7 @@ func newMigrateVHDCommand() *cobra.Command {
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
client := remote.NewFromConfig(config.Get())
|
||||
manager, err := server.NewManager(cmd.Context(), client)
|
||||
manager, err := server.NewManager(cmd.Context(), client, true)
|
||||
if err != nil {
|
||||
log.WithField("error", err).Fatal("failed to create new server manager")
|
||||
}
|
||||
@@ -48,11 +47,6 @@ func newMigrateVHDCommand() *cobra.Command {
|
||||
|
||||
// Run executes the migration command.
|
||||
func (m *MigrateVHDCommand) Run(ctx context.Context) error {
|
||||
root := filepath.Join(config.Get().System.Data, ".disks")
|
||||
if err := os.MkdirAll(root, 0600); err != nil {
|
||||
return errors.Wrap(err, "failed to create root directory for virtual disks")
|
||||
}
|
||||
|
||||
for _, s := range m.manager.All() {
|
||||
s.Log().Debug("starting migration of server contents to virtual disk...")
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
|
||||
log.WithField("error", err).Fatal("failed to initialize database")
|
||||
}
|
||||
|
||||
manager, err := server.NewManager(cmd.Context(), pclient)
|
||||
manager, err := server.NewManager(cmd.Context(), pclient, false)
|
||||
if err != nil {
|
||||
log.WithField("error", err).Fatal("failed to load server configurations")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user