Issue #16626 has been updated by Jos Backus.

Added [pull request](https://github.com/puppetlabs/facter/pull/337).

----------------------------------------
Bug #16626: Facter Ruby 1.9 compatibility issue with macaddresses and bonded 
interfaces
https://projects.puppetlabs.com/issues/16626#change-73943

Author: Jos Backus
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 2.0.0
Keywords: 
Branch: 
Affected Facter version: 


facter produces an error message on a RedHat 6 system with bonded interfaces:

<pre>
[17:35]:[root@rhel:facter-2.0.0]# facter macaddress_eth0 --trace
(?m-ix:^Slave Interface: eth0\n[^\n].+?\nPermanent HW addr: 
(([0-9a-fA-F]{2}:?)*)$)
["Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)\n", "\n", 
"Bonding Mode: fault-tolerance (active-backup)\n", "Primary Slave: None\n", 
"Currently Active Slave: eth0\n", "MII Status: up\n", "MII Polling Interval 
(ms): 80\n", "Up Delay (ms): 0\n", "Down Delay (ms): 0\n", "\n", "Slave 
Interface: eth0\n", "MII Status: up\n", "Link Failure Count: 0\n", "Permanent 
HW addr: e4:11:5b:ed:dc:f8\n", "Slave queue ID: 0\n", "\n", "Slave Interface: 
eth2\n", "MII Status: up\n", "Link Failure Count: 0\n", "Permanent HW addr: 
e4:11:5b:ed:dc:f0\n", "Slave queue ID: 0\n"]
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/ip.rb:164:in 
`get_interface_value': undefined method `[]' for nil:NilClass (NoMethodError)
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/interfaces.rb:37:in 
`block (4 levels) in <top (required)>'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/resolution.rb:277:in
 `call'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/resolution.rb:277:in
 `block in value'
        from /usr/lib64/ruby/1.9.1/timeout.rb:54:in `timeout'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/resolution.rb:275:in
 `value'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/fact.rb:75:in 
`block (2 levels) in value'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/fact.rb:71:in 
`each'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/fact.rb:71:in 
`inject'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/fact.rb:71:in 
`block in value'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/fact.rb:108:in 
`searching'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/fact.rb:67:in 
`value'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/collection.rb:129:in
 `value'
        from /usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter.rb:104:in 
`block (2 levels) in singletonclass'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/application.rb:17:in 
`block in run'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/application.rb:15:in 
`each'
        from 
/usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/application.rb:15:in 
`run'
        from /usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/bin/facter:60:in 
`<top (required)>'
        from /usr/bin/facter:23:in `load'
        from /usr/bin/facter:23:in `<main>'
[17:35]:[root@rhel:facter-2.0.0]# 
</pre>

Part of /usr/lib64/ruby/gems/1.9.1/gems/facter-2.0.0/lib/facter/util/ip.rb with 
some debugging:

<pre>
    bonddev = get_bonding_master(interface)
    if label == 'macaddress' and bonddev
      bondinfo = IO.readlines("/proc/net/bonding/#{bonddev}")
      hwaddrre = /^Slave Interface: #{interface}\n[^\n].+?\nPermanent HW addr: 
(([0-9a-fA-F]{2}:?)*)$/m
      puts hwaddrre, bondinfo.to_s
      value = hwaddrre.match(bondinfo.to_s)[1].upcase
</pre>

The fix is to change the to_s into a join, i.e.
<pre>
value = hwaddrre.match(bondinfo.join)[1].upcase
</pre>

Alternatively, the join could be chained to the readlines call, e.g.
<pre>
      bondinfo = IO.readlines("/proc/net/bonding/#{bonddev}").join
</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