Sha256: 0f78c2c223bafde0401dcdaab75de56cc36567aefe7b3dcbd69c0b026f2062f5

Contents?: true

Size: 1.14 KB

Versions: 43

Compression:

Stored size: 1.14 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_primary!).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_primary)
        repo_content_list = repo.content_list
        repo_content_list.map { |content| content.try(:pulp_href) }
      end

      def self.generate_model_row(unit)
        filename = File.basename(unit['relative_path'].try(:split, '/').try(:[], -1))

        {
          pulp_id: unit[unit_identifier],
          name: filename,
          path: unit['relative_path'],
          checksum: unit['sha256']
        }
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
katello-4.7.1 app/services/katello/pulp3/file_unit.rb
katello-4.6.2.1 app/services/katello/pulp3/file_unit.rb
katello-4.6.2 app/services/katello/pulp3/file_unit.rb
katello-4.7.0 app/services/katello/pulp3/file_unit.rb
katello-4.6.1 app/services/katello/pulp3/file_unit.rb
katello-4.7.0.rc2 app/services/katello/pulp3/file_unit.rb
katello-4.7.0.rc1 app/services/katello/pulp3/file_unit.rb
katello-4.4.2.2 app/services/katello/pulp3/file_unit.rb
katello-4.4.2.1 app/services/katello/pulp3/file_unit.rb
katello-4.4.2 app/services/katello/pulp3/file_unit.rb
katello-4.5.1 app/services/katello/pulp3/file_unit.rb
katello-4.6.0 app/services/katello/pulp3/file_unit.rb
katello-4.6.0.rc2 app/services/katello/pulp3/file_unit.rb
katello-4.6.0.rc1 app/services/katello/pulp3/file_unit.rb
katello-4.5.0 app/services/katello/pulp3/file_unit.rb
katello-4.5.0.rc2 app/services/katello/pulp3/file_unit.rb
katello-4.4.1 app/services/katello/pulp3/file_unit.rb
katello-4.5.0.rc1 app/services/katello/pulp3/file_unit.rb
katello-4.4.0.2 app/services/katello/pulp3/file_unit.rb
katello-4.4.0.1 app/services/katello/pulp3/file_unit.rb