Class: Actions::RemoteExecution::RunHostsJob

Inherits:
ActionWithSubPlans
  • Object
show all
Defined in:
app/lib/actions/remote_execution/run_hosts_job.rb

Instance Method Summary collapse

Instance Method Details

#create_sub_plansObject



13
14
15
16
17
18
# File 'app/lib/actions/remote_execution/run_hosts_job.rb', line 13

def create_sub_plans
  job_invocation = JobInvocation.find(input[:job_invocation_id])
  job_invocation.targeting.hosts.map do |host|
    trigger(RunHostJob, job_invocation, host)
  end
end

#outputObject



28
29
30
31
32
# File 'app/lib/actions/remote_execution/run_hosts_job.rb', line 28

def output
  result = super
  result[:pending_count] = (result[:total_count] || 0) - (result[:failed_count] || 0) - (result[:success_count] || 0)
  result
end

#plan(job_invocation) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/lib/actions/remote_execution/run_hosts_job.rb', line 4

def plan(job_invocation)
  action_subject(job_invocation)

  job_invocation.targeting.resolve_hosts!
  job_invocation.update_attribute :last_task_id, task.id
  input.update(:job_name => job_invocation.job_name)
  plan_self(job_invocation_id: job_invocation.id)
end

#rescue_strategyObject



20
21
22
# File 'app/lib/actions/remote_execution/run_hosts_job.rb', line 20

def rescue_strategy
  ::Dynflow::Action::Rescue::Skip
end

#run(event = nil) ⇒ Object



24
25
26
# File 'app/lib/actions/remote_execution/run_hosts_job.rb', line 24

def run(event = nil)
  super unless event == Dynflow::Action::Skip
end