Sha256: 32b46cdea400d5cf45dd8ca03d8988ec1acf5e66b77ed71cc1a02642c8b83bb0
Contents?: true
Size: 1.65 KB
Versions: 20
Compression:
Stored size: 1.65 KB
Contents
module Katello module Pulp3 class DockerManifestList < PulpContentUnit include LazyAccessor def self.content_api PulpContainerClient::ContentManifestsApi.new(Katello::Pulp3::Api::Docker.new(SmartProxy.pulp_primary!).api_client) end def self.ids_for_repository(repo_id) repo = Katello::Pulp3::Repository::Docker.new(Katello::Repository.find(repo_id), SmartProxy.pulp_primary) repo_content_list = repo.content_list repo_content_list.map { |content| content.try(:pulp_href) } end def self.content_unit_list(page_opts) page_opts[:media_type] = ["application/vnd.docker.distribution.manifest.list.v2+json"] self.content_api.list(page_opts) end def self.generate_model_row(unit) { schema_version: unit['schema_version'], digest: unit['digest'], pulp_id: unit[unit_identifier] } end def self.insert_child_associations(units, pulp_id_to_id) manifest_list_manifests = [] units.each do |unit| katello_id = pulp_id_to_id[unit[unit_identifier]] manifest_ids = ::Katello::DockerManifest.where(:pulp_id => unit[:listed_manifests]).pluck(:id) manifest_list_manifests += manifest_ids.map do |manifest_id| { docker_manifest_list_id: katello_id, docker_manifest_id: manifest_id } end end manifest_list_manifests.flatten! Katello::DockerManifestListManifest.insert_all(manifest_list_manifests, unique_by: [:docker_manifest_list_id, :docker_manifest_id]) if manifest_list_manifests.any? end end end end
Version data entries
20 entries across 20 versions & 1 rubygems