Class: Actions::Pulp3::Repository::ImportUpload

Inherits:
AbstractAsyncTask show all
Defined in:
app/lib/actions/pulp3/repository/import_upload.rb

Instance Method Summary collapse

Methods inherited from AbstractAsyncTask

#cancel, #cancel!, #combined_tasks, #done?, #external_task, #humanized_state, #new_or_existing_objects, #pulp_tasks, #rescue_external_task, #run, #task_groups

Methods inherited from Abstract

#smart_proxy

Instance Method Details

#invoke_external_taskObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/lib/actions/pulp3/repository/import_upload.rb', line 14

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

#plan(save_artifact_output, repository, smart_proxy, options = {}) ⇒ Object



7
8
9
10
11
12
# File 'app/lib/actions/pulp3/repository/import_upload.rb', line 7

def plan(save_artifact_output, repository, smart_proxy, options = {})
  plan_self(:save_artifact_output => save_artifact_output,
            :repository_id => repository.id,
            :smart_proxy_id => smart_proxy.id,
            :options => options)
end