Class: Katello::Pulp3::GenericContentUnit

Inherits:
PulpContentUnit show all
Includes:
LazyAccessor
Defined in:
app/services/katello/pulp3/generic_content_unit.rb

Constant Summary collapse

CONTENT_TYPE =
"generic".freeze

Instance Attribute Summary

Attributes inherited from PulpContentUnit

#backend_data, #uuid

Class Method Summary collapse

Methods included from LazyAccessor

included

Methods inherited from PulpContentUnit

add_timestamps, backend_unit_identifier, content_api_create, content_type, create_content, #fetch_backend_data, find_duplicate_unit, #initialize, model_class, page_options, pulp_data, pulp_units_batch_all, pulp_units_batch_for_repo, pulp_units_for_ids, supports_id_fetch?, unit_identifier

Constructor Details

This class inherits a constructor from Katello::Pulp3::PulpContentUnit

Class Method Details

.content_api(repository_type, content_type) ⇒ Object



15
16
17
18
# File 'app/services/katello/pulp3/generic_content_unit.rb', line 15

def self.content_api(repository_type, content_type)
  label = content_type.is_a?(String) ? content_type : content_type.label
  repository_type.content_types.find { |type| type.content_type == label }.pulp3_api.new(repository_type.pulp3_api_class.new(SmartProxy.pulp_primary!, repository_type).api_client)
end

.content_unit_list(page_opts, repository_type, content_type) ⇒ Object



11
12
13
# File 'app/services/katello/pulp3/generic_content_unit.rb', line 11

def self.content_unit_list(page_opts, repository_type, content_type)
  self.content_api(repository_type, content_type).list page_opts
end

.fetch_content_list(page_opts, repository_type, content_type) ⇒ Object



7
8
9
# File 'app/services/katello/pulp3/generic_content_unit.rb', line 7

def self.fetch_content_list(page_opts, repository_type, content_type)
  content_unit_list page_opts, repository_type, content_type
end

.generate_model_row(unit, content_type) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'app/services/katello/pulp3/generic_content_unit.rb', line 20

def self.generate_model_row(unit, content_type)
  {
    pulp_id: unit['pulp_href'],
    name: content_type&.model_name&.call(unit),
    version: content_type&.model_version&.call(unit),
    filename: content_type&.model_filename&.call(unit),
    additional_metadata: content_type&.&.call(unit),
    content_type: content_type&.label
  }
end