forked from TrueCloudLab/restic
migrate: show warning if migration is unknown
This commit is contained in:
parent
8d5e188218
commit
db77919550
1 changed files with 5 additions and 0 deletions
|
@ -74,8 +74,10 @@ func checkMigrations(ctx context.Context, repo restic.Repository, printer progre
|
||||||
func applyMigrations(ctx context.Context, opts MigrateOptions, gopts GlobalOptions, repo restic.Repository, args []string, term *termstatus.Terminal, printer progress.Printer) error {
|
func applyMigrations(ctx context.Context, opts MigrateOptions, gopts GlobalOptions, repo restic.Repository, args []string, term *termstatus.Terminal, printer progress.Printer) error {
|
||||||
var firsterr error
|
var firsterr error
|
||||||
for _, name := range args {
|
for _, name := range args {
|
||||||
|
found := false
|
||||||
for _, m := range migrations.All {
|
for _, m := range migrations.All {
|
||||||
if m.Name() == name {
|
if m.Name() == name {
|
||||||
|
found = true
|
||||||
ok, reason, err := m.Check(ctx, repo)
|
ok, reason, err := m.Check(ctx, repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -119,6 +121,9 @@ func applyMigrations(ctx context.Context, opts MigrateOptions, gopts GlobalOptio
|
||||||
printer.P("migration %v: success\n", m.Name())
|
printer.P("migration %v: success\n", m.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !found {
|
||||||
|
printer.E("unknown migration %v", name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return firsterr
|
return firsterr
|
||||||
|
|
Loading…
Reference in a new issue