Project

General

Profile

Download (1.13 KB) Statistics
| Branch: | Tag: | Revision:

foreman_pipeline / app / lib / actions / foreman_pipeline / job / deploy_new_host.rb @ 9fb80abe

1
module Actions
2
  module ForemanPipeline
3
    module Job
4
      class DeployNewHost < Actions::EntryAction
5
        include Mixins::UriExtension
6
        middleware.use ::Actions::Middleware::KeepCurrentUser
7

    
8
        def plan(job)
9
          sequence do
10
            # redeploy = plan_action(Redeploy, job)
11

    
12
            data = {
13
              :host => {
14
                :id => "fake_id",
15
                :name => "fake-name.example.com",
16
                :ip => "192.168.100.236"
17
                },
18
              :activation_key => {
19
                :cp_id => "asdfasdf"
20
              }
21
            }
22

    
23

    
24
            packages = plan_action(FindPackagesToInstall, :job_id => job.id)
25

    
26
            bulk_build = plan_action(Jenkins::BulkBuild,
27
                                      job.jenkins_projects,
28
                                      :job_id => job.id,
29
                                      :data => data,#redeploy.output,
30
                                      :packages => packages.output[:package_names])
31
            plan_action(Promote, :job_id => job.id, :build_fails => bulk_build.output[:failed_count])
32
          end
33
        end
34
      end
35
    end
36
  end
37
end