Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-10-02 14:20:25 +0300
committerRémy Coutable <remy@rymai.me>2018-10-02 14:20:25 +0300
commit4f4c11340a13ee2b925ad6547d953955e9bf7645 (patch)
tree1b064ecb2a8f5976284fc9359bdd8dd71b09d5f5 /app
parent974fe0797079f4f7ddc57b45d15ee7d39a06e78a (diff)
parentbba99da98cd0b3d8fbcee7b02fb3d0ad7d642a24 (diff)
Merge branch 'sh-improve-container-tags-update-username' into 'master'
Improve logging when username update fails due to registry tags See merge request gitlab-org/gitlab-ce!22038
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/storage/legacy_namespace.rb6
-rw-r--r--app/models/namespace.rb4
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}")