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)

    a customizable set of options

Options Hash (**options):

  • A (Boolean)

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



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
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/pe_build/cap/run_install/posix.rb', line 17

def self.run_install(machine, installer_path, answers, **options)
  if options.fetch(:use_pem, false)
    # NOTE: Ensure symlinks exist since minitar doesn't create them. This
    # call will be reverted once the PEM changes are finalized.
    on_machine(machine, <<-EOS)
pushd #{File.dirname(installer_path)} > /dev/null
if [ -d pe-manager ]
then
pushd pe-manager > /dev/null
ln -sf ../VERSION ../modules .
pushd packages > /dev/null
ln -sf ../../packages/* .
fi
EOS
    on_machine(machine, "#{installer_path} -c #{answers}")
  else
    # NOTE: Ensure symlinks exist since minitar doesn't create them. This
    # call will be reverted once the PEM changes are finalized.
    on_machine(machine, <<-EOS)
pushd #{File.dirname(installer_path)} > /dev/null
if [ -d legacy ]
then
pushd legacy > /dev/null
for f in $(find . -type f -empty)
do
  ln -sf ../$f $f
done
fi
EOS
    on_machine(machine, "#{installer_path} -a #{answers}")
  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