diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/storage/legacy_namespace.rb | 6 | ||||
-rw-r--r-- | app/models/namespace.rb | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/models/concerns/storage/legacy_namespace.rb b/app/models/concerns/storage/legacy_namespace.rb index 9785011720a..7723c07279d 100644 --- a/app/models/concerns/storage/legacy_namespace.rb +++ b/app/models/concerns/storage/legacy_namespace.rb @@ -5,8 +5,10 @@ module Storage extend ActiveSupport::Concern def move_dir - if any_project_has_container_registry_tags? - raise Gitlab::UpdatePathError.new('Namespace cannot be moved, because at least one project has tags in container registry') + proj_with_tags = first_project_with_container_registry_tags + + if proj_with_tags + raise Gitlab::UpdatePathError.new("Namespace #{name} (#{id}) cannot be moved because at least one project (e.g. #{proj_with_tags.name} (#{proj_with_tags.id})) has tags in container registry") end parent_was = if parent_changed? && parent_id_was.present? diff --git a/app/models/namespace.rb b/app/models/namespace.rb index c54be778d1b..599bedde27d 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -135,6 +135,10 @@ class Namespace < ActiveRecord::Base all_projects.any?(&:has_container_registry_tags?) end + def first_project_with_container_registry_tags + all_projects.find(&:has_container_registry_tags?) + end + def send_update_instructions projects.each do |project| project.send_move_instructions("#{full_path_was}/#{project.path}") |