INNER CODE UNIT · Go
resticInitialization
k8up-io/k8up · cmd/restic/main.go:175
func resticInitialization(resticCLI *resticCli.Restic, mainLogger logr.Logger) error {
if cfg.Config.SleepDuration > 0 {
mainLogger.Info("sleeping until init", "duration", cfg.Config.SleepDuration)
time.Sleep(cfg.Config.SleepDuration)
}
if err := resticCLI.Init(); err != nil {
return fmt.Errorf("failed to initialise the restic repository: %w", err)
}
if err := resticCLI.Unlock(false); err != nil {
mainLogger.Error(err, "failed to remove stale locks from the repository, continuing anyway")
}
// This builds up the cache without any other side effect. So it won't block
// during any stdin backups or such.
if err := resticCLI.Snapshots(nil, nil); err != nil {
return fmt.Errorf("failed to list snapshots: %w", err)
}