Correct internal behavior to allow running when already mounted

This commit is contained in:
Dane Everitt
2021-07-04 13:23:45 -07:00
committed by DaneEveritt
parent a6a610fd82
commit f8a25cb040
3 changed files with 74 additions and 57 deletions

View File

@@ -89,9 +89,13 @@ func (m *MigrateVHDCommand) Run(ctx context.Context) error {
}
// Copy over the files from the backup for this server.
cmd := exec.CommandContext(ctx, "cp", "-a", bak + "/.", s.Filesystem().Path())
cmd := exec.CommandContext(ctx, "mv", bak + "/*", s.Filesystem().Path())
s.Log().Debug(cmd.String())
if err := cmd.Run(); err != nil {
return errors.WithStack(err)
return errors.Wrap(err, "migrate: failed to move old server files into new direcotry")
}
if err := os.Remove(bak); err != nil {
s.Log().WithField("directory", bak).Warn("failed to remove backup directory")
}
s.Log().Info("finished migration to virtual disk...")