vendor/bundle/ruby/1.8/gems/facter-1.6.5/lib/facter/util/ec2.rb
def can_connect?(wait_sec=2)
      url = "http://169.254.169.254:80/"
      Timeout::timeout(wait_sec) {open(url)}
      return true
      rescue Timeout::Error
        return false
      rescue
        return false
    end
# Test if we can connect to the EC2 api. Return true if able to connect.
# On failure this function fails silently and returns false.
#
# The +wait_sec+ parameter provides you with an adjustable timeout.
#
Test if we can connect to the EC2 api. Return true if able to connect.
On failure this function fails silently and returns false.

The +wait_sec+ parameter provides you with an adjustable timeout.
Test if we can connect to the EC2 api . Return true if able to connect . On failure this function fails silently and returns false . The + wait_sec + parameter provides you with an adjustable timeout .
def can_connect?(wait_sec=2)
      url = "http://169.254.169.254:80/"
      Timeout::timeout(wait_sec) {open(url)}
      return true
      rescue Timeout::Error
        return false
      rescue
        return false
    end
def can_connect? ( wait_sec = 2 ) url = "http://169.254.169.254:80/" Timeout :: timeout ( wait_sec ) { open ( url ) } return true rescue Timeout :: Error return false rescue return false end
Test if we can connect to the EC2 api.
Test if we can connect to the EC2 api .
wait_sec