Skip to content

Commit

Permalink
cmd/lxd-to-incus: Fix SQL update for multiple pools
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Oct 26, 2023
1 parent a30da80 commit f44ef3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/lxd-to-incus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ func (c *cmdMigrate) Run(app *cobra.Command, args []string) error {
}

newSource := strings.Replace(source, sourcePaths.Daemon, targetPaths.Daemon, 1)
rewriteStatements = append(rewriteStatements, fmt.Sprintf("UPDATE storage_pools_config SET value='%s' WHERE value='%s'", newSource, source))
rewriteStatements = append(rewriteStatements, fmt.Sprintf("UPDATE storage_pools_config SET value='%s' WHERE value='%s';", newSource, source))
}

// Confirm migration.
Expand Down Expand Up @@ -557,7 +557,7 @@ Instances will come back online once the migration is complete.
}

// Apply custom SQL statements.
err = os.WriteFile(filepath.Join(targetPaths.Daemon, "database", "patch.global.sql"), []byte(strings.Join(rewriteStatements, "\n")), 0600)
err = os.WriteFile(filepath.Join(targetPaths.Daemon, "database", "patch.global.sql"), []byte(strings.Join(rewriteStatements, "\n")+"\n"), 0600)
if err != nil {
return fmt.Errorf("Failed to write database path: %w", err)
}
Expand Down

0 comments on commit f44ef3f

Please sign in to comment.