Issue #1697 has been reported by josh.

----------------------------------------
Bug #1697: Typo in ipaddress.rb causes timeout under Solaris 10 SPARC
http://projects.reductivelabs.com/issues/show/1697

Author: josh
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: library
Target version: 
Complexity: Trivial
Keywords: 


Simple problem, simple solution.

In  ipaddress.rb:

<pre>
Facter.add(:myipaddress, :timeout => 2) do
    setcode do
        if hostname = Facter.value(:hostname)
            # we need Hostname to exist for this to work
            host = nil
            if host = Facter::Util::Resolution.exec("host #{hostname}")
                host = host.chomp.split(/\s/)
                if defined? list[-1] and
                        list[-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/
                    list[-1]
                end
            else
                nil
            end
        else
            nil
        end
    end
end
</pre>

The problem is *host = host.chomp.split(/\s/)*. The next few lines expect the 
result of *host.chomp.split(/\s/)* to be in the *list* variable, not the *host* 
variable. Changing the problematic line to *list = host.chomp.split(/\s/)* 
fixes the timeout.

Here's a diff:

<pre>
--- ipaddress.rb.bad    2008-10-27 17:28:02.000000000 -0700
+++ ipaddress.rb        2008-10-27 17:28:45.000000000 -0700
@@ -25,7 +25,7 @@
             # we need Hostname to exist for this to work
             host = nil
             if host = Facter::Util::Resolution.exec("host #{hostname}")
-                host = host.chomp.split(/\s/)
+                list = host.chomp.split(/\s/)
                 if defined? list[-1] and
                         list[-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/
                     list[-1]
</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://reductivelabs.com/redmine/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