Add safe stale repository unlock action
This commit is contained in:
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user