Sha256: 414d412512d7cb77102d491357428ac91bd63cbac8eb27cb33013f906282c7a5

Contents?: true

Size: 1.16 KB

Versions: 16

Compression:

Stored size: 1.16 KB

Contents

module Katello
  module Pulp3
    class FileUnit < PulpContentUnit
      include LazyAccessor
      CONTENT_TYPE = "file".freeze

      def self.content_api
        PulpFileClient::ContentFilesApi.new(Katello::Pulp3::Api::File.new(SmartProxy.pulp_master!).api_client)
      end

      def self.create_content(options)
        fail _("Artifact Id and relative path are needed to create content") unless options.dig(:file_name) && options.dig(:artifact)
        PulpFileClient::FileContent.new(relative_path: options[:file_name], artifact: options[:artifact])
      end

      def self.ids_for_repository(repo_id)
        repo = Katello::Pulp3::Repository::File.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 update_model(model)
        custom_json = {}
        custom_json['checksum'] = backend_data['sha256']
        custom_json['path'] = backend_data['relative_path']
        custom_json['name'] = File.basename(backend_data['relative_path'].try(:split, '/').try(:[], -1))
        model.update!(custom_json)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.16.2 app/services/katello/pulp3/file_unit.rb
katello-3.16.1.2 app/services/katello/pulp3/file_unit.rb
katello-3.16.1.1 app/services/katello/pulp3/file_unit.rb
katello-3.16.1 app/services/katello/pulp3/file_unit.rb
katello-3.17.0.rc1 app/services/katello/pulp3/file_unit.rb
katello-3.16.0 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc5.1 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc5 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc4.1 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc4 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc3.1 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc3 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc2.1 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc2 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc1.1 app/services/katello/pulp3/file_unit.rb
katello-3.16.0.rc1 app/services/katello/pulp3/file_unit.rb