Method: Pkg::Util::Net.check_host_ssh

Defined in:
lib/packaging/util/net.rb

.check_host_ssh(hosts) ⇒ Object

Returns an array of hosts where ssh access failed. Empty array if successful.

Parameters:

    • An array of hosts to try ssh-ing into

    If the host needs a special username it should be passed in as user@host

Returns:

  • an array of hosts where ssh access failed. Empty array if successful



33
34
35
36
37
38
39
40
41
# File 'lib/packaging/util/net.rb', line 33

def check_host_ssh(hosts)
  errs = []
  Array(hosts).flatten.each do |host|
    remote_execute(host, 'exit', { extra_options: '-oBatchMode=yes' })
  rescue StandardError
    errs << host
  end
  return errs
end