Project

General

Profile

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

foreman_pipeline / app / lib / actions / foreman_pipeline / job / deploy_new_host.rb @ 5204f856

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
            # plan_action(Jenkins::WaitHostReady, :host_ip => redeploy.output[:host][:ip],
13
            #                                     :jenkins_instance_hostname => jenkins_hostname(job),
14
            #                                     :jenkins_home => job.jenkins_instance.jenkins_home,
15
            #                                     :cert_path => job.jenkins_instance.cert_path)
16

    
17
            h = {
18
              :host => {
19
                :ip => '10.168.100.4',
20
                :name => 'random name',
21
              },
22
              :activation_key => {
23
                :cp_key => '42'
24
              }
25
            }
26
            
27
            packages = plan_action(FindPackagesToInstall, :job_id => job.id)
28

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