Class: Actions::Pulp3::ContentViewVersion::Export

Inherits:
AbstractAsyncTask show all
Defined in:
app/lib/actions/pulp3/content_view_version/export.rb

Instance Method Summary collapse

Methods inherited from AbstractAsyncTask

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

Methods inherited from Abstract

#smart_proxy

Instance Method Details

#invoke_external_taskObject



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

def invoke_external_task
  repository = ::Katello::Repository.find(input[:repository_id]) unless input[:repository_id].blank?
  cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
  from_cvv = ::Katello::ContentViewVersion.find(input[:from_content_view_version_id]) unless input[:from_content_view_version_id].blank?
  ::Katello::Pulp3::ContentViewVersion::Export.create(smart_proxy: smart_proxy,
                                           content_view_version: cvv,
                                           from_content_view_version: from_cvv,
                                           format: input[:format],
                                           repository: repository)
                                           .create_export(input[:exporter_data],
                                                                chunk_size: input[:chunk_size])
end

#rescue_external_task(error) ⇒ Object



28
29
30
31
32
33
34
# File 'app/lib/actions/pulp3/content_view_version/export.rb', line 28

def rescue_external_task(error)
  if error.is_a?(::Katello::Errors::Pulp3Error) && error.message.match?(/Remote artifacts cannot be exported/)
    fail ::Katello::Errors::Pulp3ExportError, "Failed to export: One or more repositories needs to be synced (with Immediate download policy.)"
  else
    super
  end
end