Sha256: ee98e069a69d8dc845554d20113b587bd2399374c678dcb9c1797c0bbe98b9a8

Contents?: true

Size: 1.31 KB

Versions: 42

Compression:

Stored size: 1.31 KB

Contents

module Actions
  module Pulp3
    module Orchestration
      module Repository
        class UploadContent < Pulp3::Abstract
          include Actions::Helpers::OutputPropagator
          def plan(repository, smart_proxy, file, unit_type_id)
            sequence do
              content_backend_service = SmartProxy.pulp_primary.content_service(unit_type_id)
              content_list = content_backend_service.content_api.list("sha256": Digest::SHA256.hexdigest(File.read(file[:path])))
              content_href = content_list&.results&.first&.pulp_href

              unless content_href
                upload_action_output = plan_action(Pulp3::Repository::UploadFile, repository, smart_proxy, file[:path]).output
                artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, upload_action_output[:pulp_tasks], unit_type_id).output
                content_href = artifact_action_output[:pulp_tasks]
              end
              action_output = plan_action(Pulp3::Repository::ImportUpload, content_href, repository, smart_proxy).output
              plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
              plan_self(:subaction_output => action_output)
            end
          end
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
katello-4.1.4 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.0.3 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-3.18.5 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.3 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.2.0.rc1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.0.2.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.2.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.0.2 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.2 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-3.18.4 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.0 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.0.1.2 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-3.18.3.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.0.rc2.2 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.0.rc2.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.0.1.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-3.18.3 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.1.0.rc2 app/lib/actions/pulp3/orchestration/repository/upload_content.rb
katello-4.0.1 app/lib/actions/pulp3/orchestration/repository/upload_content.rb