2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

repair packs: Add stub feature flag implementation

This commit is contained in:
Michael Eischer 2023-10-22 16:40:27 +02:00
parent a28940ea29
commit d1d4510974
2 changed files with 8 additions and 3 deletions

View File

@ -349,7 +349,7 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args
for _, id := range salvagePacks { for _, id := range salvagePacks {
strIds = append(strIds, id.String()) strIds = append(strIds, id.String())
} }
Warnf("restic repair packs %v\nrestic repair snapshots --forget\n\n", strings.Join(strIds, " ")) Warnf("RESTIC_FEATURES=repair-packs-v1 restic repair packs %v\nrestic repair snapshots --forget\n\n", strings.Join(strIds, " "))
Warnf("Corrupted blobs are either caused by hardware problems or bugs in restic. Please open an issue at https://github.com/restic/restic/issues/new/choose for further troubleshooting!\n") Warnf("Corrupted blobs are either caused by hardware problems or bugs in restic. Please open an issue at https://github.com/restic/restic/issues/new/choose for further troubleshooting!\n")
} }
} }

View File

@ -36,9 +36,14 @@ func init() {
cmdRepair.AddCommand(cmdRepairPacks) cmdRepair.AddCommand(cmdRepairPacks)
} }
// FIXME feature flag
func runRepairPacks(ctx context.Context, gopts GlobalOptions, args []string) error { func runRepairPacks(ctx context.Context, gopts GlobalOptions, args []string) error {
// FIXME discuss and add proper feature flag mechanism
flag, _ := os.LookupEnv("RESTIC_FEATURES")
if flag != "repair-packs-v1" {
return errors.Fatal("This command is experimental and may change/be removed without notice between restic versions. " +
"Set the environment variable 'RESTIC_FEATURES=repair-packs-v1' to enable it.")
}
ids := restic.NewIDSet() ids := restic.NewIDSet()
for _, arg := range args { for _, arg := range args {
id, err := restic.ParseID(arg) id, err := restic.ParseID(arg)