summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Hassan <ahmad.hassan612@gmail.com>2018-05-17 15:39:59 +0300
committerAhmad Hassan <ahmad.hassan612@gmail.com>2018-05-18 11:55:54 +0300
commit125be1865b224c0a34ab8a1bbd62ac33b10e1d9b (patch)
tree65dec06bafc008cef57b8b0ab9db5230b97fd352
parent62f29887136ba39eb2c0607eba250d488ced2611 (diff)
downloadgitlab-ce-125be1865b224c0a34ab8a1bbd62ac33b10e1d9b.tar.gz
Move restore_custom_hooks to its seperate function
-rw-r--r--lib/backup/repository.rb36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 2209a305d91..3e7590e55e3 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -67,7 +67,7 @@ module Backup
end
def prepare_directories
- return if GitalyClient.feature_enabled?(:backup_skip_prepare_directories)
+ return if Gitlab::GitalyClient.feature_enabled?(:backup_skip_prepare_directories)
Gitlab.config.repositories.storages.each do |name, repository_storage|
gitaly_migrate(:remove_repositories) do |is_enabled|
@@ -95,6 +95,24 @@ module Backup
end
end
+ def restore_custom_hooks
+ gitaly_migrate(:restore_custom_hooks) do |is_enabled|
+ # TODO: Need to find a way to do this for gitaly
+ # Gitaly migration issue: https://gitlab.com/gitlab-org/gitaly/issues/1195
+ unless is_enabled
+ in_path(path_to_tars(project)) do |dir|
+ path_to_project_repo = path_to_repo(project)
+ cmd = %W(tar -xf #{path_to_tars(project, dir)} -C #{path_to_project_repo} #{dir})
+
+ output, status = Gitlab::Popen.popen(cmd)
+ unless status.zero?
+ progress_warn(project, cmd.join(' '), output)
+ end
+ end
+ end
+ end
+ end
+
def restore
prepare_directories
gitlab_shell = Gitlab::Shell.new
@@ -123,21 +141,7 @@ module Backup
progress.puts "[Failed] restoring #{project.full_path} repository".color(:red)
end
- gitaly_migrate(:restore_custom_hooks) do |is_enabled|
- # TODO: Need to find a way to do this for gitaly
- # Gitaly migration issue: https://gitlab.com/gitlab-org/gitaly/issues/1195
- unless is_enabled
- in_path(path_to_tars(project)) do |dir|
- path_to_project_repo = path_to_repo(project)
- cmd = %W(tar -xf #{path_to_tars(project, dir)} -C #{path_to_project_repo} #{dir})
-
- output, status = Gitlab::Popen.popen(cmd)
- unless status.zero?
- progress_warn(project, cmd.join(' '), output)
- end
- end
- end
- end
+ restore_custom_hooks unless Gitlab::GitalyClient.feature_enabled?(:backup_skip_restore_custom_hooks)
wiki = ProjectWiki.new(project)
path_to_wiki_bundle = path_to_bundle(wiki)