Method: Unix::Pkg#install_local_package

Defined in:
lib/beaker/host/unix/pkg.rb

#install_local_package(onhost_package_file, onhost_copy_dir = nil) ⇒ Object

Installs a package already located on a SUT

Parameters:

  • onhost_package_file (String)

    Path to the package file to install

  • onhost_copy_dir (String) (defaults to: nil)

    Path to the directory where the package file is located. Used on solaris only

Returns:

  • nil



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
# File 'lib/beaker/host/unix/pkg.rb', line 509

def install_local_package(onhost_package_file, onhost_copy_dir = nil)
  variant, version, arch, codename = self['platform'].to_array
  case variant
  when /^(fedora|el|redhat|centos)$/
    command_name = 'yum'
    command_name = 'dnf' if variant == 'fedora' && version > 21
    execute("#{command_name} --nogpgcheck localinstall -y #{onhost_package_file}")
  when /^(sles)$/
    execute("zypper --non-interactive --no-gpg-checks in #{onhost_package_file}")
  when /^(debian|ubuntu|cumulus)$/
    execute("dpkg -i --force-all #{onhost_package_file}")
    execute("apt-get update")
  when /^solaris$/
    self.solaris_install_local_package( onhost_package_file, onhost_copy_dir )
  when /^osx$/
    install_package( onhost_package_file )
  else
    msg = "Platform #{variant} is not supported by the method "
    msg << 'install_local_package'
    raise ArgumentError, msg
  end
end