Issue #2346 has been updated by R.I. Pienaar aka Volcane.

James Turnbull wrote:
> Paul - how about this code:
> 
> http://bazaar.launchpad.net/~eythian/+junk/ec2facts/annotate/head:/facts/ec2facts.rb

I think these 2 solve different problems.  The original facter fact will take 
all the meta data and add facts for them.  The code in this link will add facts 
from the user data and only the instanceid nothing else.

This script above works but: i had to change the URLs to not be a date specific 
instead 'latest' also the path to arp isnt always right and the IP for 
retrieving the information will only be in the ARP cache if there's been a 
connection attempt so a fresh boot wont have it.

----------------------------------------
Bug #2346: ec2.rb open-uri "open" doesn't like the port argument
http://projects.puppetlabs.com/issues/2346

Author: Chris Ferry
Status: Needs design decision
Priority: Normal
Assigned to: Paul Nasrat
Category: library
Target version: 1.6.0
Keywords: ec2
Branch: 


ec2.rb(main):032:0* if can_connect?("169.254.169.254","80")
ec2.rb(main):033:1>   metadata
ec2.rb(main):034:1> end
Exception `ArgumentError' at /usr/lib/ruby/1.8/open-uri.rb:32 - illegal access 
mode 80
So this collection will fail all the time.

Following is what I did to fix:
8,9c8,9
< def can_connect?(ip,port,wait_sec=2)
<  Timeout::timeout(wait_sec) {open(ip, port)}
---
> def can_connect?(ip,wait_sec=2)
>  Timeout::timeout(wait_sec) {open(ip)}
32c32
< if can_connect?("169.254.169.254","80")
---
> if can_connect?("169.254.169.254")
35d34
< 


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to