class ForemanTasksCore::Runner::Action
Public Instance Methods
failed_run?()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 64 def failed_run? output[:exit_status] != 0 end
finalize()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 23 def finalize # To mark the task as a whole as failed error! 'Script execution failed' if failed_run? end
finish_run(update)
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 51 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 36 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 32 def initiate_runner raise NotImplementedError end
kill_run()
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 46 def kill_run runner_dispatcher.kill(output[:runner_id]) suspend end
process_update(update)
click to toggle source
# File lib/foreman_tasks_core/runner/action.rb, line 55 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 28 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 ::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 42 def runner_dispatcher Runner::Dispatcher.instance end