class ForemanTasksCore::Runner::Action
Public Instance Methods
failed_run?()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 71 def failed_run? output[:exit_status] != 0 end
finalize()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 25 def finalize # To mark the task as a whole as failed error! 'Script execution failed' if on_proxy? && failed_run? end
finish_run(update)
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 53 def finish_run(update) output[:exit_status] = update.exit_status end
init_run()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 38 def init_run output[:result] = [] output[:runner_id] = runner_dispatcher.start(suspended_action, initiate_runner) suspend end
initiate_runner()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 34 def initiate_runner raise NotImplementedError end
kill_run()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 48 def kill_run runner_dispatcher.kill(output[:runner_id]) suspend end
process_external_event(event)
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 57 def process_external_event(event) runner_dispatcher.external_event(output[:runner_id], event) suspend end
process_update(update)
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 62 def process_update(update) output[:result].concat(update.continuous_output.raw_outputs) if update.exit_status finish_run(update) else suspend end end
rescue_strategy_for_self()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 30 def rescue_strategy_for_self ::Dynflow::Action::Rescue::Fail end
run(event = nil)
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 7 def run(event = nil) case event when nil init_run when Runner::Update process_update(event) when Runner::ExternalEvent process_external_event(event) when ::Dynflow::Action::Cancellable::Cancel kill_run else raise "Unexpected event #{event.inspect}" end rescue => e action_logger.error(e) process_update(Runner::Update.encode_exception('Proxy error', e)) end
runner_dispatcher()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 44 def runner_dispatcher Runner::Dispatcher.instance end