Sha256: c41365e6a4279262ed3dfdb5ebbd876076f409089be95cd8141e482076e9f5d1

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

module Katello
  module Pulp3
    class AnsibleCollection < PulpContentUnit
      include LazyAccessor

      def self.content_api
        PulpAnsibleClient::ContentCollectionVersionsApi.new(Katello::Pulp3::Repository::AnsibleCollection.api_client(SmartProxy.pulp_master!))
      end

      def self.ids_for_repository(repo_id)
        repo = Katello::Pulp3::Repository::AnsibleCollection.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
        repo_content_list = repo.content_list
        repo_content_list.map { |content| content.try(:pulp_href) }
      end

      def self.pulp_data(_pulp_href)
        #No content read method
        fail NotImplementedError
      end

      def update_model(model)
        custom_json = {}
        custom_json['checksum'] = backend_data['sha256']
        custom_json['namespace'] = backend_data['namespace']
        custom_json['version'] = backend_data['version']
        custom_json['name'] = backend_data['name']
        custom_json['description'] = backend_data['description']
        model.update_attributes!(custom_json)

        tags = backend_data['tags'].map { |tag| Katello::AnsibleTag.find_or_create_by(name: tag['name']) }
        model.tags = tags
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-3.14.1 app/services/katello/pulp3/ansible_collection.rb
katello-3.14.0 app/services/katello/pulp3/ansible_collection.rb
katello-3.14.0.rc2 app/services/katello/pulp3/ansible_collection.rb
katello-3.14.0.rc1 app/services/katello/pulp3/ansible_collection.rb