Class: Katello::Pulp3::DockerManifestList
Constant Summary
collapse
- PULPCORE_CONTENT_TYPE =
"container.manifest".freeze
Instance Attribute Summary
#backend_data, #uuid
Class Method Summary
collapse
included
add_timestamps, backend_unit_identifier, content_api_create, content_type, create_content, #fetch_backend_data, fetch_content_list, find_duplicate_unit, #initialize, katello_name_from_pulpcore_name, model_class, pulp_data, pulp_units_batch_all, pulp_units_batch_for_repo, pulp_units_for_ids, supports_id_fetch?, unit_identifier
Class Method Details
.content_api(smart_proxy = SmartProxy.pulp_primary!) ⇒ Object
7
8
9
|
# File 'app/services/katello/pulp3/docker_manifest_list.rb', line 7
def self.content_api(smart_proxy = SmartProxy.pulp_primary!)
PulpContainerClient::ContentManifestsApi.new(Katello::Pulp3::Api::Docker.new(smart_proxy).api_client)
end
|
.content_unit_list(page_opts = {}) ⇒ Object
23
24
25
|
# File 'app/services/katello/pulp3/docker_manifest_list.rb', line 23
def self.content_unit_list(page_opts = {})
self.content_api.list(self.page_options(page_opts))
end
|
.generate_model_row(unit) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/services/katello/pulp3/docker_manifest_list.rb', line 27
def self.generate_model_row(unit)
{
schema_version: unit['schema_version'],
digest: unit['digest'],
pulp_id: unit[unit_identifier],
pulp_prn: unit['prn'],
annotations: unit['annotations'],
labels: unit['labels'],
is_bootable: unit['is_bootable'] || unit['type'] == 'bootable',
is_flatpak: unit['is_flatpak'] || unit['type'] == 'flatpak',
content_type: unit['type'],
}
end
|
.ids_for_repository(repo_id) ⇒ Object
11
12
13
14
15
|
# File 'app/services/katello/pulp3/docker_manifest_list.rb', line 11
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
|
.insert_child_associations(units, pulp_id_to_id) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'app/services/katello/pulp3/docker_manifest_list.rb', line 41
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
|
.page_options(page_opts = {}) ⇒ Object
17
18
19
20
21
|
# File 'app/services/katello/pulp3/docker_manifest_list.rb', line 17
def self.page_options(page_opts = {})
page_opts[:media_type] = ['application/vnd.docker.distribution.manifest.list.v2+json',
'application/vnd.oci.image.index.v1+json']
page_opts
end
|