Class: ForemanTasksCore::SingleRunnerBatchAction
- Inherits:
-
BatchAction
- Object
- Dynflow::Action
- BatchAction
- ForemanTasksCore::SingleRunnerBatchAction
- Defined in:
- lib/foreman_tasks_core/single_runner_batch_action.rb
Instance Method Summary collapse
- #check_for_errors!(optional = true) ⇒ Object
- #finalize ⇒ Object
- #initiate ⇒ Object
- #on_finish ⇒ Object
- #plan(launcher, input_hash) ⇒ Object
- #rescue_strategy_for_self ⇒ Object
- #run(event = nil) ⇒ Object
Methods inherited from BatchAction
Instance Method Details
#check_for_errors!(optional = true) ⇒ Object
20 21 22 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 20 def check_for_errors!(optional = true) super unless optional end |
#finalize ⇒ Object
30 31 32 33 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 30 def finalize output.delete(:results) check_for_errors! end |
#initiate ⇒ Object
15 16 17 18 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 15 def initiate ping suspended_action wait_for_sub_plans sub_plans end |
#on_finish ⇒ Object
24 25 26 27 28 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 24 def on_finish output[:results] = sub_plans.map(&:entry_action).reduce({}) do |acc, cur| acc.merge(cur.execution_plan_id => cur.output) end end |
#plan(launcher, input_hash) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 3 def plan(launcher, input_hash) launcher.launch_children(self, input_hash) sequence do results = plan_self plan_action BatchCallback, launcher.prepare_batch(input_hash), results.output[:results] end end |
#rescue_strategy_for_self ⇒ Object
35 36 37 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 35 def rescue_strategy_for_self Dynflow::Action::Rescue::Skip end |
#run(event = nil) ⇒ Object
11 12 13 |
# File 'lib/foreman_tasks_core/single_runner_batch_action.rb', line 11 def run(event = nil) super unless event == Dynflow::Action::Skip end |