Class: Actions::Pulp::Consumer::ContentInstall

Inherits:
AbstractContentAction show all
Includes:
Helpers::Presenter, ExpectOneTask
Defined in:
app/lib/actions/pulp/consumer/content_install.rb

Constant Summary

Constants inherited from AbstractAsyncTask

AbstractAsyncTask::FINISHED_STATES

Instance Method Summary collapse

Methods included from ExpectOneTask

#external_task=

Methods inherited from AbstractContentAction

#external_task=, #find_errors, #process_timeout, #rescue_strategy

Methods inherited from AbstractAsyncTask

#cancel, #cancel!, #done?, #external_task, #humanized_state, #rescue_external_task, #run

Methods inherited from Abstract

#pulp_extensions, #pulp_resources

Instance Method Details

#check_error_detailsObject



27
28
29
30
31
32
33
34
35
# File 'app/lib/actions/pulp/consumer/content_install.rb', line 27

def check_error_details
  output[:pulp_tasks].each do |pulp_task|
    error_details = pulp_task.try(:[], "result").try(:[], "details").try(:[], "rpm").try(:[], "details").try(:[], "trace")
    error_message = pulp_task.try(:[], "result").try(:[], "details").try(:[], "rpm").try(:[], "details").try(:[], "message")
    if error_details && error_details.include?("YumDownloadError") && error_message
      fail _("An error occurred during the sync \n%{error_message}") % {:error_message => error_details}
    end
  end
end

#finalizeObject



23
24
25
# File 'app/lib/actions/pulp/consumer/content_install.rb', line 23

def finalize
  check_error_details
end

#invoke_external_taskObject



14
15
16
17
18
19
20
21
# File 'app/lib/actions/pulp/consumer/content_install.rb', line 14

def invoke_external_task
  task = pulp_extensions.consumer.install_content(input[:consumer_uuid],
                                           input[:type],
                                           input[:args],
                                            "importkeys" => true)
  schedule_timeout(Setting['content_action_accept_timeout'])
  task
end

#presenterObject



37
38
39
# File 'app/lib/actions/pulp/consumer/content_install.rb', line 37

def presenter
  Consumer::ContentPresenter.new(self)
end