diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-07-21 16:01:40 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-07-22 15:17:25 +0300 |
commit | 680358ae91f32a5e6c2e7c1d8f61b890d6e0a9f8 (patch) | |
tree | b9c35c89b063b74b4c9e07c13a8e6359c6ada7f0 | |
parent | 5d4ede3e06833fbbeecbd35714f02c4ab9a47681 (diff) |
repository: Convert RemoveRepository to use locator for the tempdir
The `RemoveRepository()` RPC uses `tempdir.TempDir()` to locate the
temporary directory of a storage. Given that this interface is going
away, convert the RPC to use `locator.TempDir()` instead.
-rw-r--r-- | internal/gitaly/service/repository/remove.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/gitaly/service/repository/remove.go b/internal/gitaly/service/repository/remove.go index aa0b2b123..30c8e2edb 100644 --- a/internal/gitaly/service/repository/remove.go +++ b/internal/gitaly/service/repository/remove.go @@ -9,7 +9,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v14/internal/helper" - "gitlab.com/gitlab-org/gitaly/v14/internal/tempdir" "gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo" "gitlab.com/gitlab-org/gitaly/v14/internal/transaction/voting" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" @@ -28,7 +27,11 @@ func (s *server) RemoveRepository(ctx context.Context, in *gitalypb.RemoveReposi return nil, helper.ErrInvalidArgumentf("storage %v not found", repo.GetStorageName()) } - tempDir := tempdir.TempDir(storage) + tempDir, err := s.locator.TempDir(storage.Name) + if err != nil { + return nil, helper.ErrInternalf("temporary directory: %w", err) + } + if err := os.MkdirAll(tempDir, 0755); err != nil { return nil, helper.ErrInternal(err) } |