Method: Beaker::DSL::InstallUtils#installer_cmd

Defined in:
lib/beaker/dsl/install_utils.rb

#installer_cmd(host, opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create the PE install command string based upon the host and options settings

Examples:

on host, "#{installer_cmd(host, opts)} -a #{host['working_dir']}/answers"

Parameters:

  • host (Host)

    The host that PE is to be installed on For UNIX machines using the full PE installer, the host object must have the ‘pe_installer’ field set correctly.

  • opts (Hash{Symbol=>String})

    The options

Options Hash (opts):

  • :pe_ver_win (String)

    Default PE version to install or upgrade to on Windows hosts (Othersie uses individual Windows hosts pe_ver)

  • :pe_ver (String)

    Default PE version to install or upgrade to (Otherwise uses individual hosts pe_ver)

  • :pe_debug (Boolean) — default: false

    Should we run the installer in debug mode?



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/beaker/dsl/install_utils.rb', line 166

def installer_cmd(host, opts)
  version = host['pe_ver'] || opts[:pe_ver]
  if host['platform'] =~ /windows/
    log_file = "#{File.basename(host['working_dir'])}.log"
    pe_debug = host[:pe_debug] || opts[:pe_debug] ? " && cat #{log_file}" : ''
    if host.is_cygwin?
      "cd #{host['working_dir']} && cmd /C 'start /w msiexec.exe /qn /L*V #{log_file} /i #{host['dist']}.msi PUPPET_MASTER_SERVER=#{master} PUPPET_AGENT_CERTNAME=#{host}'#{pe_debug}"
    else
      "cd #{host['working_dir']} &&  msiexec.exe /qn /L*V #{log_file} /i #{host['dist']}.msi PUPPET_MASTER_SERVER=#{master} PUPPET_AGENT_CERTNAME=#{host}#{pe_debug}"
    end
  # Frictionless install didn't exist pre-3.2.0, so in that case we fall
  # through and do a regular install.
  elsif host['roles'].include? 'frictionless' and ! version_is_less(version, '3.2.0')
    # PE 3.4 introduced the ability to pass in config options to the bash script in the form
    # of <section>:<key>=<value>
    frictionless_install_opts = []
    if host.has_key?('frictionless_options') and !  version_is_less(version, '3.4.0')
      # since we have options to pass in, we need to tell the bash script
      host['frictionless_options'].each do |section, settings|
        settings.each do |key, value|
          frictionless_install_opts << "#{section}:#{key}=#{value}"
        end
      end
    end

    pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -x' : ''
    "cd #{host['working_dir']} && curl --tlsv1 -kO https://#{master}:8140/packages/#{version}/install.bash && bash#{pe_debug} install.bash #{frictionless_install_opts.join(' ')}".strip
  elsif host['platform'] =~ /osx/
    version = host['pe_ver'] || opts[:pe_ver]
    pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -verboseR' : ''
    "cd #{host['working_dir']} && hdiutil attach #{host['dist']}.dmg && installer#{pe_debug} -pkg /Volumes/puppet-enterprise-#{version}/puppet-enterprise-installer-#{version}.pkg -target /"
  elsif host['platform'] =~ /eos/
    commands = ['enable', "extension puppet-enterprise-#{version}-#{host['platform']}.swix"]
    command = commands.join("\n")
    "Cli -c '#{command}'"
  else
    pe_debug = host[:pe_debug] || opts[:pe_debug]  ? ' -D' : ''
    "cd #{host['working_dir']}/#{host['dist']} && ./#{host['pe_installer']}#{pe_debug} -a #{host['working_dir']}/answers"
  end
end