Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-05-02 19:15:51 +0300
committerDouwe Maan <douwe@gitlab.com>2018-05-02 19:15:51 +0300
commit66ba430d7fe53d5e953f49ba1fb1be218e70786e (patch)
tree7dda15e59dcc409461d7c192c3e36006fb1c9f02
parentadec373f46187c1be75dd5c748090afb55fb2b06 (diff)
parent12be728b173ccfe76588f23d440b2fb2514f9997 (diff)
Merge branch 'zj-namespace-service-mandatory' into 'master'
Remove old GitLab Shell namespace actions implementations See merge request gitlab-org/gitlab-ce!18681
-rw-r--r--changelogs/unreleased/zj-namespace-service-mandatory.yml5
-rw-r--r--lib/gitlab/shell.rb44
2 files changed, 9 insertions, 40 deletions
diff --git a/changelogs/unreleased/zj-namespace-service-mandatory.yml b/changelogs/unreleased/zj-namespace-service-mandatory.yml
new file mode 100644
index 00000000000..d890741c51b
--- /dev/null
+++ b/changelogs/unreleased/zj-namespace-service-mandatory.yml
@@ -0,0 +1,5 @@
+---
+title: Finish NamespaceService migration to Gitaly
+merge_request:
+author:
+type: performance
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb
index 156115f8a8f..4a691d640b3 100644
--- a/lib/gitlab/shell.rb
+++ b/lib/gitlab/shell.rb
@@ -294,17 +294,7 @@ module Gitlab
# add_namespace("default", "gitlab")
#
def add_namespace(storage, name)
- Gitlab::GitalyClient.migrate(:add_namespace,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled|
- if enabled
- Gitlab::GitalyClient::NamespaceService.new(storage).add(name)
- else
- path = full_path(storage, name)
- FileUtils.mkdir_p(path, mode: 0770) unless exists?(storage, name)
- end
- end
- rescue Errno::EEXIST => e
- Rails.logger.warn("Directory exists as a file: #{e} at: #{path}")
+ Gitlab::GitalyClient::NamespaceService.new(storage).add(name)
rescue GRPC::InvalidArgument => e
raise ArgumentError, e.message
end
@@ -316,14 +306,7 @@ module Gitlab
# rm_namespace("default", "gitlab")
#
def rm_namespace(storage, name)
- Gitlab::GitalyClient.migrate(:remove_namespace,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled|
- if enabled
- Gitlab::GitalyClient::NamespaceService.new(storage).remove(name)
- else
- FileUtils.rm_r(full_path(storage, name), force: true)
- end
- end
+ Gitlab::GitalyClient::NamespaceService.new(storage).remove(name)
rescue GRPC::InvalidArgument => e
raise ArgumentError, e.message
end
@@ -335,17 +318,7 @@ module Gitlab
# mv_namespace("/path/to/storage", "gitlab", "gitlabhq")
#
def mv_namespace(storage, old_name, new_name)
- Gitlab::GitalyClient.migrate(:rename_namespace,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled|
- if enabled
- Gitlab::GitalyClient::NamespaceService.new(storage)
- .rename(old_name, new_name)
- else
- break false if exists?(storage, new_name) || !exists?(storage, old_name)
-
- FileUtils.mv(full_path(storage, old_name), full_path(storage, new_name))
- end
- end
+ Gitlab::GitalyClient::NamespaceService.new(storage).rename(old_name, new_name)
rescue GRPC::InvalidArgument
false
end
@@ -370,17 +343,8 @@ module Gitlab
# exists?(storage, 'gitlab')
# exists?(storage, 'gitlab/cookies.git')
#
- # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/385
def exists?(storage, dir_name)
- Gitlab::GitalyClient.migrate(:namespace_exists,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled|
- if enabled
- Gitlab::GitalyClient::NamespaceService.new(storage)
- .exists?(dir_name)
- else
- File.exist?(full_path(storage, dir_name))
- end
- end
+ Gitlab::GitalyClient::NamespaceService.new(storage).exists?(dir_name)
end
protected