Sha256: 7e98823c87faea905c4c48eb943a36ccdd1883a91cd49598f688e3eff9aeb45e

Contents?: true

Size: 1.42 KB

Versions: 144

Compression:

Stored size: 1.42 KB

Contents

module PSWindows::Pkg
  include Beaker::CommandFactory

  def check_for_command(name)
    result = exec(Beaker::Command.new("where #{name}"), :accept_all_exit_codes => true)
    result.exit_code == 0
  end

  def check_for_package(name)
    #HACK NOOP
    #raise "Cannot check for package #{name} on #{self}"
    0
  end

  def install_package(name, cmdline_args = '')
    #HACK NOOP
    #raise "Package #{name} cannot be installed on #{self}"
    0
  end

  def uninstall_package(name, cmdline_args = '')
    #HACK NOOP
    #raise "Package #{name} cannot be uninstalled on #{self}"
    0
  end

  #Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used
  #@return [Boolean] true if x86_64, false otherwise
  def determine_if_x86_64
    (identify_windows_architecture =~ /64/) == 0
  end

  private

  # @api private
  def identify_windows_architecture
    arch = nil
    execute("wmic os get osarchitecture", :accept_all_exit_codes => true) do |result|
      arch = if result.exit_code == 0
        result.stdout =~ /64/ ? '64' : '32'
      else
        identify_windows_architecture_from_os_name_for_win2003
      end
    end
    arch
  end

  # @api private
  def identify_windows_architecture_from_os_name_for_win2003
    arch = nil
    execute("wmic os get name", :accept_all_exit_codes => true) do |result|
      arch = result.stdout =~ /64/ ? '64' : '32'
    end
    arch
  end
end

Version data entries

144 entries across 144 versions & 1 rubygems

Version Path
beaker-4.38.1 lib/beaker/host/pswindows/pkg.rb
beaker-4.38.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.37.2 lib/beaker/host/pswindows/pkg.rb
beaker-4.37.1 lib/beaker/host/pswindows/pkg.rb
beaker-4.37.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.36.1 lib/beaker/host/pswindows/pkg.rb
beaker-4.36.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.35.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.34.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.33.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.32.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.31.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.30.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.29.1 lib/beaker/host/pswindows/pkg.rb
beaker-4.29.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.28.1 lib/beaker/host/pswindows/pkg.rb
beaker-4.28.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.27.1 lib/beaker/host/pswindows/pkg.rb
beaker-4.27.0 lib/beaker/host/pswindows/pkg.rb
beaker-4.26.0 lib/beaker/host/pswindows/pkg.rb