Add emergency repository unlock

This commit is contained in:
Mikei386
2026-06-21 13:59:10 +02:00
parent 84df215ad0
commit 92ba5ce05f
11 changed files with 68 additions and 9 deletions
+13
View File
@@ -414,6 +414,19 @@ func (s *Service) UnlockRepository(ctx context.Context, repoID string) error {
return s.restic.Unlock(ctx, mounted.Repository)
}
func (s *Service) ForceUnlockRepository(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.ForceUnlock(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" {