Merge branch 'fix-old-migration-repos-path-key' into 'master'
Update references to deprecated `repos_path` configuration key to avoid ## What does this MR do? Update references to deprecated `repos_path` configuration key to avoid errors when updating GitLab from older versions ## Why was this MR needed? Users were reporting errors when upgrading from GitLab 6.7 ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1464 See merge request !6350
This commit is contained in:
commit
44a4274c0e
|
@ -1,12 +1,15 @@
|
||||||
# rubocop:disable all
|
# rubocop:disable all
|
||||||
class MigrateRepoSize < ActiveRecord::Migration
|
class MigrateRepoSize < ActiveRecord::Migration
|
||||||
|
DOWNTIME = false
|
||||||
|
|
||||||
def up
|
def up
|
||||||
project_data = execute('SELECT projects.id, namespaces.path AS namespace_path, projects.path AS project_path FROM projects LEFT JOIN namespaces ON projects.namespace_id = namespaces.id')
|
project_data = execute('SELECT projects.id, namespaces.path AS namespace_path, projects.path AS project_path FROM projects LEFT JOIN namespaces ON projects.namespace_id = namespaces.id')
|
||||||
|
|
||||||
project_data.each do |project|
|
project_data.each do |project|
|
||||||
id = project['id']
|
id = project['id']
|
||||||
namespace_path = project['namespace_path'] || ''
|
namespace_path = project['namespace_path'] || ''
|
||||||
path = File.join(Gitlab.config.gitlab_shell.repos_path, namespace_path, project['project_path'] + '.git')
|
repos_path = Gitlab.config.gitlab_shell['repos_path'] || Gitlab.config.repositories.storages.default
|
||||||
|
path = File.join(repos_path, namespace_path, project['project_path'] + '.git')
|
||||||
|
|
||||||
begin
|
begin
|
||||||
repo = Gitlab::Git::Repository.new(path)
|
repo = Gitlab::Git::Repository.new(path)
|
||||||
|
|
|
@ -22,10 +22,6 @@ module Gitlab
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def repos_path
|
|
||||||
Gitlab.config.gitlab_shell.repos_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def path_to_repo
|
def path_to_repo
|
||||||
@project.repository.path_to_repo
|
@project.repository.path_to_repo
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue