Class: Specinfra::Command::Alpine::Base::Host

Inherits:
Base::Host show all
Defined in:
lib/specinfra/command/alpine/base/host.rb

Class Method Summary collapse

Methods inherited from Base::Host

check_is_resolvable, get_ipaddress, get_ipv4_address, get_ipv6_address

Methods inherited from Base

create, escape

Class Method Details

.check_is_reachable(host, port, proto, timeout) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/specinfra/command/alpine/base/host.rb', line 3

def check_is_reachable(host, port, proto, timeout)
  if port.nil?
    "ping -w #{escape(timeout)} -c 2 -n #{escape(host)}"
  else
    "nc -w #{escape(timeout)} -vvvvz#{proto.downcase.start_with?('u') ? 'u' : ''} #{escape(host)} #{escape(port)}"
  end
end