Project

General

Profile

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

foreman_pipeline / app / lib / actions / foreman_pipeline / job / deploy_new_host.rb @ be52ca64

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
            # plan_action(JenkinsInstance::Keyscan, :cert_path => job.jenkins_instance.cert_path,
18
            #                                       :jenkins_url => job.jenkins_instance.url,
19
            #                                       :jenkins_home => job.jenkins_instance.jenkins_home,
20
            #                                       :host_ip => redeploy.output[:host][:ip])            
21

    
22
            # packages = plan_action(FindPackagesToInstall, :job_id => job.id)
23

    
24
            h = { :host => {
25
                    :id => "random_number",
26
                    :name => "dummy host",
27
                    :ip => "192.168.100.103",
28
                    :mac => " 01:23:45:67:89:ab",
29
                    :params => ["host_params_empty"]
30
                  },
31
                  :activation_key => {
32
                      :cp_id => 544553785444,
33
                  },
34
                  :packages => ["cat", "rat", "bat"]
35
            }
36

    
37
            bulk_build = plan_action(Jenkins::BulkBuild, 
38
                                      job.jenkins_projects,
39
                                      :job_id => job.id,
40
                                      :data => h)#{:packages => packages.output[:package_names]}.merge(redeploy.output))
41
            # plan_action(Promote, :job_id => job.id, :build_fails => bulk_build.output[:failed_count])
42
            
43
          end
44
        end
45
      end
46
    end
47
  end
48
end