lib/beaker/dsl/install_utils/pe_utils.rb
#Perform a Puppet Enterprise Higgs install up until web browser interaction is required, runs on linux hosts only.
# @param [Host] host The host to install higgs on
# @param  [Hash{Symbol=>Symbol, String}] opts The options
# @option opts [String] :pe_dir Default directory or URL to pull PE package from
#                  (Otherwise uses individual hosts pe_dir)
# @option opts [String] :pe_ver Default PE version to install
#                  (Otherwise uses individual hosts pe_ver)
# @option opts [Boolean] :fetch_local_then_push_to_host determines whether
#                 you use Beaker as the middleman for this (true), or curl the
#                 file from the host (false; default behavior)
# @raise [StandardError] When installation times out
#
# @example
#  do_higgs_install(master, {:pe_dir => path, :pe_ver => version})
#
# @api private
#
Perform a Puppet Enterprise Higgs install up until web browser interaction is required, runs on linux hosts only.
Perform a Puppet Enterprise Higgs install up until web browser interaction is required runs on linux hosts only .
def do_higgs_install host, opts
          use_all_tar = ENV['PE_USE_ALL_TAR'] == 'true'
          platform = use_all_tar ? 'all' : host['platform']
          version = host['pe_ver'] || opts[:pe_ver]
          host['dist'] = "puppet-enterprise-#{version}-#{platform}"
          use_all_tar = ENV['PE_USE_ALL_TAR'] == 'true'
          host['pe_installer'] ||= 'puppet-enterprise-installer'
          host['working_dir'] = host.tmpdir(Time.new.strftime("%Y-%m-%d_%H.%M.%S"))
          fetch_pe([host], opts)
          host['higgs_file'] = "higgs_#{File.basename(host['working_dir'])}.log"
          on host, higgs_installer_cmd(host), opts
          higgs_re = /Please\s+go\s+to\s+https:\/\/.*\s+in\s+your\s+browser\s+to\s+continue\s+installation/m
          res = Result.new(host, 'tmp cmd')
          tries = 10
          attempts = 0
          prev_sleep = 0
          cur_sleep = 1
          while (res.stdout !~ higgs_re) and (attempts < tries)
            res = on host, "cd #{host['working_dir']}/#{host['dist']} && cat #{host['higgs_file']}", :accept_all_exit_codes => true
            attempts += 1
            sleep( cur_sleep )
            prev_sleep = cur_sleep
            cur_sleep = cur_sleep + prev_sleep
          end
          if attempts >= tries
            raise "Failed to kick off PE (Higgs) web installation"
          end
        end
def do_higgs_install host , opts use_all_tar = ENV [ 'PE_USE_ALL_TAR' ] == 'true' platform = use_all_tar ? 'all' : host [ 'platform' ] version = host [ 'pe_ver' ] || opts [ :pe_ver ] host [ 'dist' ] = "puppet-enterprise-#{version}-#{platform}" use_all_tar = ENV [ 'PE_USE_ALL_TAR' ] == 'true' host [ 'pe_installer' ] ||= 'puppet-enterprise-installer' host [ 'working_dir' ] = host . tmpdir ( Time . new . strftime ( "%Y-%m-%d_%H.%M.%S" ) ) fetch_pe ( [ host ] , opts ) host [ 'higgs_file' ] = "higgs_#{File.basename(host['working_dir'])}.log" on host , higgs_installer_cmd ( host ) , opts higgs_re = / Please \s +go \s +to \s +https: \/ \/ .* \s +in \s +your \s +browser \s +to \s +continue \s +installation /m res = Result . new ( host , 'tmp cmd' ) tries = 10 attempts = 0 prev_sleep = 0 cur_sleep = 1 while ( res . stdout !~ higgs_re ) and ( attempts < tries ) res = on host , "cd #{host['working_dir']}/#{host['dist']} && cat #{host['higgs_file']}" , :accept_all_exit_codes => true attempts += 1 sleep ( cur_sleep ) prev_sleep = cur_sleep cur_sleep = cur_sleep + prev_sleep end if attempts >= tries raise "Failed to kick off PE (Higgs) web installation" end end
Perform a Puppet Enterprise Higgs install up until web browser interaction is required, runs on linux hosts only.
Perform a Puppet Enterprise Higgs install up until web browser interaction is required runs on linux hosts only .
#wait for output to host['higgs_file'] #we're all done when we find this line in the PE installation log
[StandardError] When installation times out
[ StandardError ] When installation times out
host
<not_specific>
opts
:fetch_local_then_push_to_host determines whether you use Beaker as the middleman for this (true), or curl the file from the host (false; default behavior)
: fetch_local_then_push_to_host determines whether you use Beaker as the middleman for this ( true ) or curl the file from the host ( false ; default behavior )
<not_specific>
opts The options
opts The options
example
do_higgs_install(master, {:pe_dir => path, :pe_ver => version})
do_higgs_install ( master { : pe_dir = > path : pe_ver = > version } )
api
None