1
|
module Actions
|
2
|
module ForemanPipeline
|
3
|
module Job
|
4
|
class JobHook < Actions::EntryAction
|
5
|
middleware.use ::Actions::Middleware::KeepCurrentUser
|
6
|
|
7
|
def run
|
8
|
fail "Multiple jobs defined for the same content view and environment: #{input[:job_names]}.
|
9
|
This may result in an unexpected behaviour.
|
10
|
Resolve the conflict to avoid skipping this action." if input[:job_names].length > 1
|
11
|
jobs = input[:job_ids].map { |id| ::ForemanPipeline::Job.find id }
|
12
|
jobs.map do |job|
|
13
|
ForemanTasks.trigger(DeployNewHost, job)
|
14
|
end
|
15
|
end
|
16
|
|
17
|
def rescue_strategy_for_self
|
18
|
Dynflow::Action::Rescue::Skip
|
19
|
end
|
20
|
|
21
|
end
|
22
|
end
|
23
|
end
|
24
|
end
|