Class: Actions::Pulp3::Repository::MultiCopyContent

Inherits:
AbstractAsyncTask show all
Defined in:
app/lib/actions/pulp3/repository/multi_copy_content.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



16
17
18
19
20
21
22
23
24
# File 'app/lib/actions/pulp3/repository/multi_copy_content.rb', line 16

def invoke_external_task
  repo_id_map = {}

  input[:repo_id_map].each do |source_repo_ids, dest_repo_map|
    repo_id_map[source_repo_ids] = dest_repo_map.deep_dup
  end

  output[:pulp_tasks] = ::Katello::Repository.find(repo_id_map.values.first[:dest_repo]).backend_service(smart_proxy).copy_content_from_mapping(repo_id_map, input)
end

#plan(extended_repo_map, smart_proxy, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/lib/actions/pulp3/repository/multi_copy_content.rb', line 5

def plan(extended_repo_map, smart_proxy, options)
  repo_id_map = {}

  extended_repo_map.each do |source_repos, dest_repo_map|
    repo_id_map[source_repos&.map(&:id)] = { :dest_repo => dest_repo_map[:dest_repo].id,
                                             :filter_ids => dest_repo_map[:filters]&.map(&:id) }
  end

  plan_self(options.merge(:repo_id_map => repo_id_map, :smart_proxy_id => smart_proxy.id))
end