Sha256: a2a4e9d9adfd18b62eb1a34be39de903b099d220fadee3d8e4b7139db4deaf50
Contents?: true
Size: 860 Bytes
Versions: 11
Compression:
Stored size: 860 Bytes
Contents
require 'ping' require 'thread' class RSUtils class << self def mk_rs_cache_dir(prefix=nil) tmpdir = Dir.tmpdir _prefix = prefix || "cap-rightscale" begin path = "#{tmpdir}/#{_prefix}-#{ENV['USER']}-#{rand(0x100000000).to_s(36)}" Dir.mkdir(path, 0700) rescue Errno::EEXIST warn(e) exit(1) end end def valid_echo(host_list, logger) hosts = host_list threads = [] hosts.each do |host| threads << Thread.new {Ping.pingecho(host)} end threads.each_with_index do |t,i| unless t.value logger.info("Server dead or Firewall blocking: #{hosts[i]}") hosts[i] = nil else logger.info("Server alive: #{hosts[i]}") end end hosts.delete(nil) threads.clear hosts end end end
Version data entries
11 entries across 11 versions & 1 rubygems