Add safe stale repository unlock action

This commit is contained in:
Mikei386
2026-06-15 00:25:27 +02:00
parent 054fde24d3
commit e23563afb1
11 changed files with 67 additions and 9 deletions
+13
View File
@@ -232,6 +232,19 @@ func (s *Service) TestRepository(ctx context.Context, repoID string, initialize
return err
}
func (s *Service) UnlockRepository(ctx context.Context, repoID string) error {
repo, ok := s.repository(repoID)
if !ok {
return errors.New("validation: unknown repository")
}
mounted, err := s.mounts.Prepare(ctx, repo)
if err != nil {
return err
}
defer s.mounts.Cleanup(context.Background(), mounted)
return s.restic.Unlock(ctx, mounted.Repository)
}
func (s *Service) execute(ctx context.Context, run model.Run) model.Run {
ctx = restic.WithRunID(ctx, run.ID)
if run.TaskType == "backup" {