~ubuntu-branches/ubuntu/maverick/facter/maverick-updates

« back to all changes in this revision

Viewing changes to lib/facter/ec2.rb

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2011-10-25 10:43:54 UTC
  • Revision ID: package-import@ubuntu.com-20111025104354-69asaollusprprvm
Tags: 1.5.7-1ubuntu1.2
* lib/facter/ec2.rb: Properly handle ip+port when testing connectivity
  of ec2 metadata service.(LP: #732953)
* lib/facter/util/collection.rb: Backported fix from upstream commit
  2255abee7bdb9b6478ca228546e3d275dbac0ec3. Reload all facts if the
  requested fact is not found.  Ensures consistency after facts
  have been cleared. (LP: #876130)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
require 'timeout'
7
7
 
8
8
def can_connect?(ip,port,wait_sec=2)
9
 
 Timeout::timeout(wait_sec) {open(ip, port)}
 
9
 url = "http://#{ip}:#{port}"
 
10
 Timeout::timeout(wait_sec) {open(url)}
10
11
 return true
11
12
rescue
12
13
  return false