Issue #17154 has been reported by Avishai Ish-Shalom.

----------------------------------------
Bug #17154: ipaddress does not work on fedora 17
https://projects.puppetlabs.com/issues/17154

Author: Avishai Ish-Shalom
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Keywords: ipaddress
Branch: 
Affected Facter version: 1.6.13


ifconfig is being deprecated in favor of iproute2. as a result ifconfig output 
on fedora 17 (now actually `ip address` output) does not parse as expected. the 
following custom fact does work:
<pre><code class="ruby">
Facter.add(:ipaddress) do
  confine :kernel => :linux, :operatingsystem => "Fedora", 
:operatingsystemrelease => "17"
  setcode do
    ip = nil
    output = %x{/sbin/ip a 2>/dev/null}

    output.split(/^\S/).each { |str|
      if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
        tmp = $1
        unless tmp =~ /^127\./
          ip = tmp
          break
        end
      end
    }

    ip
  end
end
</code></pre>
Alternatively, we can use Ruby's `Socket.ip_address_list`


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