Class: PEBuild::Cap::RunInstall::POSIX

Inherits:
Object
  • Object
show all
Extended by:
OnMachine
Defined in:
lib/pe_build/cap/run_install/posix.rb

Class Method Summary collapse

Methods included from OnMachine

on_machine

Class Method Details

.run_install(machine, installer_path, answers, **options) ⇒ void

This method returns an undefined value.

Run the PE installer on POSIX systems

Parameters:

  • machine (Vagrant::Machine)

    The Vagrant machine on which to run the installation.

  • installer_dir (String)

    A path to the directory where PE installers are kept.

  • answers (String)

    A path to a file containing installation answers.

  • options (Hash)

    Additional options that influence installer behavior.

Options Hash (**options):

  • :use_pem (Boolean)

    A flag which controls whether the PEM installer introduced in 2016.2 should be used.

  • :update_gpg (Boolean)

    A flag which controls whether the GPG key shipped with th installer introduced in 2016.2 should be used.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/pe_build/cap/run_install/posix.rb', line 22

def self.run_install(machine, installer_path, answers, **options)
  if options.fetch(:use_pem, false)
    on_machine(machine, "DISABLE_ANALYTICS=1 #{installer_path}/puppet-enterprise-installer -c #{answers}")
  else
    on_machine(machine, "#{installer_path}/puppet-enterprise-installer -a #{answers}")
  end

  # Update GPG key used by pe_repo.
  if options.fetch(:update_gpg, false)
    machine.ui.info I18n.t('pebuild.cap.run_install.updating_pe_repo_gpg_key')
    on_machine(machine, <<-EOS)
if [ -e #{installer_path}/gpg/GPG-KEY-puppetlabs ]; then
if [ -e /opt/puppetlabs/puppet/modules/pe_repo ]; then
  cp #{installer_path}/gpg/GPG-KEY-puppetlabs /opt/puppetlabs/puppet/modules/pe_repo/files/GPG-KEY-puppetlabs
elif [ -e /opt/puppet/share/puppet/modules/pe_repo ]; then
  cp #{installer_path}/gpg/GPG-KEY-puppetlabs /opt/puppet/share/puppet/modules/pe_repo/files/GPG-KEY-puppetlabs
fi
fi
EOS
  end

  if machine.communicate.test('which at')
    machine.ui.info I18n.t('pebuild.cap.run_install.scheduling_run')
    machine.communicate.sudo("echo 'PATH=/opt/puppet/bin:/opt/puppetlabs/puppet/bin:$PATH puppet agent -t --waitforcert 10' | at now '+ 1min'")
  end
end