Method: Beaker::HostPrebuiltSteps#validate_host

Defined in:
lib/beaker/host_prebuilt_steps.rb

#validate_host(host, opts) ⇒ Object

Validate that hosts are prepared to be used as SUTs, if packages are missing attempt to install them.

Verifies the presence of #UNIX_PACKAGES on unix platform hosts, SLES_PACKAGES on SUSE platform hosts, DEBIAN_PACKAGES on debian platform hosts, CUMULUS_PACKAGES on cumulus platform hosts, WINDOWS_PACKAGES on cygwin-installed windows platform hosts, and PSWINDOWS_PACKAGES on non-cygwin windows platform hosts.

Parameters:

  • host (Host, Array<Host>, String, Symbol)

    One or more hosts to act upon

  • opts (Hash{Symbol=>String})

    Options to alter execution.

Options Hash (opts):



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/beaker/host_prebuilt_steps.rb', line 91

def validate_host host, opts
  logger = opts[:logger]
  block_on host do |host|
    case
    when host['platform'] =~ /sles-10/
      check_and_install_packages_if_needed(host, SLES10_PACKAGES)
    when host['platform'] =~ /sles-/
      check_and_install_packages_if_needed(host, SLES_PACKAGES)
    when host['platform'] =~ /debian/
      check_and_install_packages_if_needed(host, DEBIAN_PACKAGES)
    when host['platform'] =~ /cumulus/
      check_and_install_packages_if_needed(host, CUMULUS_PACKAGES)
    when (host['platform'] =~ /windows/ and host.is_cygwin?)
      check_and_install_packages_if_needed(host, WINDOWS_PACKAGES)
    when (host['platform'] =~ /windows/ and not host.is_cygwin?)
      check_and_install_packages_if_needed(host, PSWINDOWS_PACKAGES)
    when host['platform'] =~ /freebsd/
      check_and_install_packages_if_needed(host, FREEBSD_PACKAGES)
    when host['platform'] =~ /openbsd/
      check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
    when host['platform'] =~ /solaris-10/
      check_and_install_packages_if_needed(host, SOLARIS10_PACKAGES)
    when host['platform'] !~ /debian|aix|solaris|windows|sles-|osx-|cumulus|f5-|netscaler|cisco-/
      check_and_install_packages_if_needed(host, UNIX_PACKAGES)
    end
  end
rescue => e
  report_and_raise(logger, e, "validate")
end