mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 14:17:42 +00:00
Fix #3166
This commit is contained in:
parent
5e22ae10f1
commit
6e942693ba
9
changelog/unreleased/issue-3166
Normal file
9
changelog/unreleased/issue-3166
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Bugfix: Improve error handling in restore
|
||||||
|
|
||||||
|
Restic restore used to not print errors while downloading file contents from
|
||||||
|
the repository. restore also incorrectly exited with a zero error code even
|
||||||
|
when there were errors during the restore process. Now, a non-zero code is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
https://github.com/restic/restic/issues/3166
|
||||||
|
https://github.com/restic/restic/pull/3207
|
@ -191,14 +191,26 @@ func runRestore(opts RestoreOptions, gopts GlobalOptions, args []string) error {
|
|||||||
Verbosef("restoring %s to %s\n", res.Snapshot(), opts.Target)
|
Verbosef("restoring %s to %s\n", res.Snapshot(), opts.Target)
|
||||||
|
|
||||||
err = res.RestoreTo(ctx, opts.Target)
|
err = res.RestoreTo(ctx, opts.Target)
|
||||||
if err == nil && opts.Verify {
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if totalErrors > 0 {
|
||||||
|
return errors.Fatalf("There were %d errors\n", totalErrors)
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Verify {
|
||||||
Verbosef("verifying files in %s\n", opts.Target)
|
Verbosef("verifying files in %s\n", opts.Target)
|
||||||
var count int
|
var count int
|
||||||
count, err = res.VerifyFiles(ctx, opts.Target)
|
count, err = res.VerifyFiles(ctx, opts.Target)
|
||||||
Verbosef("finished verifying %d files in %s\n", count, opts.Target)
|
if err != nil {
|
||||||
}
|
|
||||||
if totalErrors > 0 {
|
|
||||||
Printf("There were %d errors\n", totalErrors)
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if totalErrors > 0 {
|
||||||
|
return errors.Fatalf("There were %d errors\n", totalErrors)
|
||||||
|
}
|
||||||
|
Verbosef("finished verifying %d files in %s\n", count, opts.Target)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user