diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-09 22:41:48 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-09 22:41:48 +0300 |
commit | d5d8e76bd79cd9d61c66539a5069104cf46be2bd (patch) | |
tree | ff2762c9d1cb3616d32212e3299368d07c510d83 /app/models/namespace.rb | |
parent | b5043d5d33ed2a213889dfe52c819addd0d847ef (diff) | |
download | gitlab-ce-d5d8e76bd79cd9d61c66539a5069104cf46be2bd.tar.gz |
Block renaming project or repository if it has container registry tags
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 741e912171d..0f61cee7888 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -127,6 +127,10 @@ class Namespace < ActiveRecord::Base # Ensure old directory exists before moving it gitlab_shell.add_namespace(path_was) + if any_project_has_container_registry_tags? + raise Exception.new('namespace cannot be moved, because at least one project has tags in container registry') + end + if gitlab_shell.mv_namespace(path_was, path) Gitlab::UploadsTransfer.new.rename_namespace(path_was, path) @@ -148,6 +152,10 @@ class Namespace < ActiveRecord::Base end end + def any_project_has_container_registry_tags? + projects.any?(:has_container_registry_tags?) + end + def send_update_instructions projects.each do |project| project.send_move_instructions("#{path_was}/#{project.path}") |