class Facter::EC2::Base
Public Instance Methods
reachable?(retry_limit = 3)
click to toggle source
# File lib/facter/ec2/rest.rb, line 22 def reachable?(retry_limit = 3) timeout = 0.5 able_to_connect = false attempts = 0 begin open(@baseurl, :proxy => nil, :read_timeout => timeout).read able_to_connect = true rescue OpenURI::HTTPError => e if e.message.match /404 Not Found/i able_to_connect = false else attempts = attempts + 1 retry if attempts < retry_limit end rescue Timeout::Error attempts = attempts + 1 retry if attempts < retry_limit rescue *CONNECTION_ERRORS attempts = attempts + 1 retry if attempts < retry_limit end able_to_connect end