diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-23 16:00:41 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-23 16:00:41 +0300 |
commit | 01d159b409d8b24d36204979a73de249843d71bf (patch) | |
tree | 8450df71c27dd6ebf1c48d779273502ac8fb4d15 /app | |
parent | bd8c8df6ed8dd7321608ce652e23d86ef3bd6899 (diff) |
Rename container image model to container repository
Diffstat (limited to 'app')
-rw-r--r-- | app/models/container_repository.rb (renamed from app/models/container_image.rb) | 14 | ||||
-rw-r--r-- | app/services/auth/container_registry_authentication_service.rb | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/app/models/container_image.rb b/app/models/container_repository.rb index 434302159b0..2e78fc148b4 100644 --- a/app/models/container_image.rb +++ b/app/models/container_repository.rb @@ -1,4 +1,4 @@ -class ContainerImage < ActiveRecord::Base +class ContainerRepository < ActiveRecord::Base belongs_to :project delegate :container_registry, to: :project @@ -18,7 +18,7 @@ class ContainerImage < ActiveRecord::Base end def manifest - @manifest ||= client.repository_tags(name_with_namespace) + @manifest ||= client.repository_tags(self.path) end def tags @@ -39,24 +39,24 @@ class ContainerImage < ActiveRecord::Base digests = tags.map {|tag| tag.digest }.to_set digests.all? do |digest| - client.delete_repository_tag(name_with_namespace, digest) + client.delete_repository_tag(self.path, digest) end end - def self.project_from_path(image_path) - return unless image_path.include?('/') + def self.project_from_path(repository_path) + return unless repository_path.include?('/') ## # Projects are always located inside a namespace, so we can remove # the last node, and see if project with that path exists. # - truncated_path = image_path.slice(0...image_path.rindex('/')) + truncated_path = repository_path.slice(0...repository_path.rindex('/')) ## # We still make it possible to search projects by a full image path # in order to maintain backwards compatibility. # Project.find_by_full_path(truncated_path) || - Project.find_by_full_path(image_path) + Project.find_by_full_path(repository_path) end end diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index 2205b0897e2..3d151c6a357 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -62,7 +62,7 @@ module Auth end def process_repository_access(type, name, actions) - requested_project = ContainerImage.project_from_path(name) + requested_project = ContainerRepository.project_from_path(name) return unless requested_project |