diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-06-14 12:27:33 -0400 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-06-14 12:32:51 -0400 |
commit | 98c5e6295b201eeaa760d104f9b43e237f1dbd49 (patch) | |
tree | 9769f7903dabe8b5f8745ced9eb9f1bcf6d7fee4 /lib/backup | |
parent | c6cc7680e7da89c145b7e2075266791a3f594eec (diff) | |
download | gitlab-ce-shards-test.tar.gz |
Refactor repository paths handling to allow multiple git mount pointsshards-test
Diffstat (limited to 'lib/backup')
-rw-r--r-- | lib/backup/repository.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb index 7b91215d50b..9686b0b6f40 100644 --- a/lib/backup/repository.rb +++ b/lib/backup/repository.rb @@ -2,8 +2,6 @@ require 'yaml' module Backup class Repository - attr_reader :repos_path - def dump prepare @@ -50,10 +48,12 @@ module Backup end def restore - if File.exists?(repos_path) + Gitlab.config.repositories.storages.each do |name, path| + next unless File.exists?(path) + # Move repos dir to 'repositories.old' dir - bk_repos_path = File.join(repos_path, '..', 'repositories.old.' + Time.now.to_i.to_s) - FileUtils.mv(repos_path, bk_repos_path) + bk_repos_path = File.join(path, '..', 'repositories.old.' + Time.now.to_i.to_s) + FileUtils.mv(path, bk_repos_path) end FileUtils.mkdir_p(repos_path) @@ -61,7 +61,7 @@ module Backup Project.find_each(batch_size: 1000) do |project| $progress.print " * #{project.path_with_namespace} ... " - project.namespace.ensure_dir_exist if project.namespace + project.ensure_dir_exist if File.exists?(path_to_bundle(project)) FileUtils.mkdir_p(path_to_repo(project)) @@ -120,10 +120,6 @@ module Backup File.join(backup_repos_path, project.path_with_namespace + ".bundle") end - def repos_path - Gitlab.config.gitlab_shell.repos_path - end - def backup_repos_path File.join(Gitlab.config.backup.path, "repositories") end |