Sha256: 107a143952caa760e785f0665f4cf00e98cd577d6aa4f41ee74bb59e2249579a

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

# This action takes a content unit and a repository
# Creates a content unit based on content type and then creates a new repository version with the added content.
module Actions
  module Pulp3
    module Repository
      class ImportUpload < Pulp3::AbstractAsyncTask
        def plan(save_artifact_output, repository, smart_proxy)
          plan_self(:save_artifact_output => save_artifact_output,
                    :repository_id => repository.id,
                    :smart_proxy_id => smart_proxy.id)
        end

        def invoke_external_task
          if input[:save_artifact_output][:pulp_tasks]&.any?
            content_unit_href = input[:save_artifact_output][:pulp_tasks].last[:created_resources].first
          else
            content_unit_href = input[:save_artifact_output][:content_unit_href]
          end

          repo = ::Katello::Repository.find(input[:repository_id])
          repo_backend_service = repo.backend_service(smart_proxy)
          output[:content_unit_href] = content_unit_href
          output[:pulp_tasks] = [repo_backend_service.add_content(content_unit_href)]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.3.0.rc2.1 app/lib/actions/pulp3/repository/import_upload.rb
katello-4.3.0.rc2 app/lib/actions/pulp3/repository/import_upload.rb
katello-4.3.0.rc1 app/lib/actions/pulp3/repository/import_upload.rb