Issue #19921 has been updated by Sebastiaan van S.

Status changed from Unreviewed to Investigating
Assignee set to Sebastiaan van S

----------------------------------------
Bug #19921: Fedora Core ifconfig output different to RedHat so ipaddress6 is 
not set
https://projects.puppetlabs.com/issues/19921#change-94579

* Author: Tony Kew
* Status: Investigating
* Priority: High
* Assignee: Sebastiaan van S
* Category: 
* Target version: 
* Keywords: ipaddress6
fedora
fc18
* Branch: 
* Affected Facter version: development
----------------------------------------
rhelhost$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
rhelhost$ ifconfig eth0 | grep inet6
          inet6 addr: fe80::1234:1234:1234:1234/64 Scope:Link
          inet6 addr: fdf3:f194:7b0a:710e::34/64 Scope:Global
rhelhost$ facter | grep ^ipaddress6
ipaddress6 => fdf3:f194:7b0a:710e::34
rhelhost$ 

        
fc18host$ cat /etc/redhat-release 
Fedora release 18 (Spherical Cow)
fc18host$ ifconfig p2p1 | grep inet6
        inet6 fdf3:f194:7b0a:710e::50  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::4321:4321:4321:4321  prefixlen 64  scopeid 0x20<link>
fc18host$ facter | grep ^ipaddress6
fc18host$ 

The code in /usr/share/ruby/vendor_ruby/facter/ipaddress6.rb
searches for the IPv6 address after 'inet6 addr:' which does not
work on FC18 where the address follows (just) 'inet6'

fc18host$ cat /usr/share/ruby/vendor_ruby/facter/ipaddress6.rb
[...]
Facter.add(:ipaddress6) do
  confine :kernel => :linux
  setcode do
    output = Facter::Util::Resolution.exec('/sbin/ifconfig 2>/dev/null')

    get_address_after_token(output, 'inet6 addr:')
  end
end
[...]
fc18host$ 


A possible fix is to use /sbin/ip, if available.  The following
works for me:


Facter.add(:ipaddress6) do
  confine :kernel => :linux
  if File.executable?("/sbin/ip")
    # use /sbin/ip
    output = Facter::Util::Resolution.exec('/sbin/ip -family inet6 address list 
2>/dev/null')
    output = get_address_after_token(output, 'inet6')
    setcode do
      output
    end
  else
    # use /sbin/ifconfig
    setcode do
      output = Facter::Util::Resolution.exec('/sbin/ifconfig 2>/dev/null')

      get_address_after_token(output, 'inet6 addr:')
    end
  end
end




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to