Class: PEBuild::Provisioner::PEBootstrap::PostInstall

Inherits:
Object
  • Object
show all
Includes:
OnMachine
Defined in:
lib/pe_build/provisioner/pe_bootstrap/post_install.rb

Instance Method Summary collapse

Methods included from OnMachine

#on_machine

Constructor Details

#initialize(machine, config, work_dir) ⇒ PostInstall

Returns a new instance of PostInstall.



6
7
8
9
10
11
# File 'lib/pe_build/provisioner/pe_bootstrap/post_install.rb', line 6

def initialize(machine, config, work_dir)
  @machine, @config = machine, config

  @post_install_dir = Pathname.new(File.join(work_dir, 'post-install'))
  @post_install_manifest = @post_install_dir.join("#{@machine.name}.pp")
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pe_build/provisioner/pe_bootstrap/post_install.rb', line 15

def run
  if needs_post_install?
    @machine.ui.info I18n.t('pebuild.provisioner.pe_bootstrap.post_install')

    resources = []

    if PEBuild::Util::VersionString.compare(@config.version, '3.7.0') < 0 then
      resources << gen_httpd
    else
      resources << gen_puppetserver
    end
    resources << gen_relocate if @config.relocate_manifests
    resources << gen_autosign if @config.autosign

    manifest = resources.join("\n\n")
    write_manifest(manifest)

    if PEBuild::Util::VersionString.compare(@config.version, '4.0.0') < 0 then
      puppet_apply  = "/opt/puppet/bin/puppet apply"
    else
      puppet_apply  = "/opt/puppetlabs/bin/puppet apply"
    end

    manifest_path = "/vagrant/.pe_build/post-install/#{@machine.name}.pp"

    on_machine(@machine, "#{puppet_apply} #{manifest_path}")
  end
end