Method: Beaker::HostPrebuiltSteps#check_and_install_packages_if_needed

Defined in:
lib/beaker/host_prebuilt_steps.rb

#check_and_install_packages_if_needed(host, package_list) ⇒ Object

Installs the given packages if they aren’t already on a host

Parameters:

  • host (Host)

    Host to act on

  • package_list (Array<String>)

    List of package names to install



99
100
101
102
103
104
105
106
# File 'lib/beaker/host_prebuilt_steps.rb', line 99

def check_and_install_packages_if_needed host, package_list
  package_list.each do |string|
    alternatives = string.split('|')
    next if alternatives.any? { |pkg| host.check_for_package pkg }

    install_one_of_packages host, alternatives
  end
end