Commit 5af456a0 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Small refactor in LegacyNamespace and moved back send_update_instructions

parent c9ae679c
...@@ -7,7 +7,7 @@ module Storage ...@@ -7,7 +7,7 @@ module Storage
raise Gitlab::UpdatePathError.new('Namespace cannot be moved, because at least one project has tags in container registry') raise Gitlab::UpdatePathError.new('Namespace cannot be moved, because at least one project has tags in container registry')
end end
# Move the namespace directory in all storages paths used by member projects # Move the namespace directory in all storage paths used by member projects
repository_storage_paths.each do |repository_storage_path| repository_storage_paths.each do |repository_storage_path|
# Ensure old directory exists before moving it # Ensure old directory exists before moving it
gitlab_shell.add_namespace(repository_storage_path, full_path_was) gitlab_shell.add_namespace(repository_storage_path, full_path_was)
...@@ -49,12 +49,6 @@ module Storage ...@@ -49,12 +49,6 @@ module Storage
private private
def send_update_instructions
projects.each do |project|
project.send_move_instructions("#{full_path_was}/#{project.path}")
end
end
def old_repository_storage_paths def old_repository_storage_paths
@old_repository_storage_paths ||= repository_storage_paths @old_repository_storage_paths ||= repository_storage_paths
end end
...@@ -76,8 +70,7 @@ module Storage ...@@ -76,8 +70,7 @@ module Storage
new_path = "#{full_path}+#{id}+deleted" new_path = "#{full_path}+#{id}+deleted"
if gitlab_shell.mv_namespace(repository_storage_path, full_path, new_path) if gitlab_shell.mv_namespace(repository_storage_path, full_path, new_path)
message = "Namespace directory \"#{full_path}\" moved to \"#{new_path}\"" Gitlab::AppLogger.info %Q(Namespace directory "#{full_path}" moved to "#{new_path}")
Gitlab::AppLogger.info message
# Remove namespace directroy async with delay so # Remove namespace directroy async with delay so
# GitLab has time to remove all projects first # GitLab has time to remove all projects first
......
...@@ -125,6 +125,12 @@ class Namespace < ActiveRecord::Base ...@@ -125,6 +125,12 @@ class Namespace < ActiveRecord::Base
all_projects.any?(&:has_container_registry_tags?) all_projects.any?(&:has_container_registry_tags?)
end end
def send_update_instructions
projects.each do |project|
project.send_move_instructions("#{full_path_was}/#{project.path}")
end
end
def kind def kind
type == 'Group' ? 'group' : 'user' type == 'Group' ? 'group' : 'user'
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment