1
|
module Actions
|
2
|
module ForemanPipeline
|
3
|
module Job
|
4
|
class RunJobManually < Actions::EntryAction
|
5
|
|
6
|
def plan(job)
|
7
|
if job.is_valid? && job.target_cv_version_avail? && job.not_yet_promoted?
|
8
|
plan_action(DeployNewHost, job)
|
9
|
plan_self(:info => "Manually triggered job started.", :name => job.name)
|
10
|
else
|
11
|
plan_self(:info => "Manually triggered job execution skipped, check job configuration.", :name => job.name, :fail => true)
|
12
|
end
|
13
|
end
|
14
|
|
15
|
def run
|
16
|
output = input
|
17
|
fail input[:info] if input[:fail]
|
18
|
end
|
19
|
|
20
|
def rescue_strategy_for_self
|
21
|
Dynflow::Action::Rescue::Skip
|
22
|
end
|
23
|
|
24
|
def humanized_name
|
25
|
"Run manually ForemanPipeline::Job: #{input[:name]}"
|
26
|
end
|
27
|
end
|
28
|
end
|
29
|
end
|
30
|
end
|