Issue #2346 has been updated by Patrick Ramsey.

Nick's patch is the correct one.  It doesn't *introduce* a 2 second timeout; it 
enables one which was already accepted and is supposed to be happening.

Chris's original patch does not actually fix the issue; the issue is that 
open-uri only monkeypatches open() to be able to recognize non-file:/// uri 
schemas; not to take TCPSocket.open() semantics.  Eliminating the second 
argument (which open() sees as the mode) does *not* solve the problem, as it 
still sees "169.254.169.254" as a file name.  It should be called with 
"http://#{ip}:#{port}/"; as its only argument.

Nick Lewis wrote:
> There's a patch for this here:
> 
> http://groups.google.com/group/puppet-dev/browse_thread/thread/ab1570b7fc9c49fd/c7fa205e641bec46
> 
> But it mentions causing a delay, which seems not to have been addressed.


----------------------------------------
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
Assignee: Paul Nasrat
Category: library
Target version: 1.6.0
Keywords: ec2
Branch: 
http://github.com/LiorCohen/facter/commit/3113d2ad94d428319817c2aea3ef20accbd3c349


<pre>
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
</pre>
So this collection will fail all the time.

Following is what I did to fix:
<pre>
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
< 
</pre>


-- 
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