Sha256: ddb6ffe140ef103c71d6955499ffdf56b24631e85f64c3d524200da8f24b1daf

Contents?: true

Size: 910 Bytes

Versions: 3

Compression:

Stored size: 910 Bytes

Contents

require 'pe_build/on_machine'
class PEBuild::Cap::RunInstall::Windows

  extend PEBuild::OnMachine

  # Run the PE installer on Windows systems
  #
  # @param installer_dir [String] A path to the PE installer.
  # @param answers [Hash[String => String}] A hash of options that will be
  #   passed to msiexec as `key=value` pairs.
  #
  # @return [void]
  def self.run_install(machine, installer_path, answers)
    install_options = answers.map{|e| e.join('=')}.join(' ')
    # Lots of PowerShell commands can handle UNIX-style paths. msiexec can't.
    installer_path = installer_path.gsub('/', '\\')

    cmd = <<-EOS
$params = @(
  "/qn",
  "/i `"#{installer_path}`"",
  "/l*v puppet-enterprise-installer.log",
  "#{install_options}"
)

(Start-Process -FilePath "msiexec.exe" -ArgumentList $params -Wait -Passthru).ExitCode
EOS

    machine.ui.info "Running: #{cmd}"

    on_machine(machine, cmd)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-pe_build-0.14.2 lib/pe_build/cap/run_install/windows.rb
vagrant-pe_build-0.14.1 lib/pe_build/cap/run_install/windows.rb
vagrant-pe_build-0.14.0 lib/pe_build/cap/run_install/windows.rb