Sha256: 03c8baf05358e0d8cc9a5fa53dd047a48209aabf1354fcb11300997c39baffcf

Contents?: true

Size: 1.29 KB

Versions: 16

Compression:

Stored size: 1.29 KB

Contents

module Actions
  module Pulp
    module Orchestration
      module Repository
        class UploadContent < Pulp::Abstract
          def plan(repository, smart_proxy, file, unit_type_id)
            sequence do
              upload_request = plan_action(Pulp::Repository::CreateUploadRequest)
              plan_action(Pulp::Repository::UploadFile,
                          upload_id: upload_request.output[:upload_id],
                          file: file[:path])
              plan_action(Pulp::Repository::ImportUpload,
                          repository, smart_proxy,
                          pulp_id: repository.pulp_id,
                          unit_type_id: unit_type_id,
                          unit_key: unit_key(file, repository),
                          upload_id: upload_request.output[:upload_id])
              plan_action(Pulp::Repository::DeleteUploadRequest,
                          upload_id: upload_request.output[:upload_id])
            end
          end

          def unit_key(file, repository)
            return {} unless repository.file?
            {
              :checksum => Digest::SHA256.hexdigest(File.read(file[:path])),
              :name => file[:filename],
              :size => File.size(file[:path])
            }
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.3 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.2 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.1.1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0.1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0.rc2 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0.rc1.3 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0.rc1.2 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0.rc1.1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.15.0.rc1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.14.1 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.14.0 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.14.0.rc2 app/lib/actions/pulp/orchestration/repository/upload_content.rb
katello-3.14.0.rc1 app/lib/actions/pulp/orchestration/repository/upload_content.rb