Module: LoomExt::CoreMods::Net::Actions

Defined in:
lib/loomext/coremods/net.rb

Instance Method Summary collapse

Instance Method Details

#check_netObject

Raises:



21
22
23
# File 'lib/loomext/coremods/net.rb', line 21

def check_net
  raise NoNetworkError, "no network available" unless has_net?
end

#has_net?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/loomext/coremods/net.rb', line 15

def has_net?
  loom.timeout :timeout => @net_timeout do
    loom.test :sh, "-c", "while ! ping -c1 #{@check_host}; do true; done"
  end
end

#with_net(&block) ⇒ Object



25
26
27
28
# File 'lib/loomext/coremods/net.rb', line 25

def with_net(&block)
  check_net
  yield if block_given?
end