Issue #3703 has been reported by Allan Marcus.
----------------------------------------
Bug #3703: facter may not report the correct macaddress on multi port Macs
http://projects.puppetlabs.com/issues/3703
Author: Allan Marcus
Status: Unreviewed
Priority: Normal
Assigned to:
Category:
Target version:
Keywords:
Branch:
The macaddress.rb code for facter under darwin doesn't take into account multi
port macs. the ipaddress.rb code does. I copied the code from ipaddress.rb to
macaddress.rb and it works.
I also propose changing the check for 10baseT to determine if there is an
enternet address to "ether".
I'm not set up to submit code changes, so I will include the proposed code here.
I appreciate your help.
This is proposed code for facter/macaddress.rb for the darwin section.
Facter.add(:macaddress) do
confine :kernel => :darwin
setcode do
ether = nil
ip = nil
iface = ""
output = %x{/usr/sbin/netstat -rn}
if output =~ /^default\s*\S*\s*\S*\s*\S*\s*\S*\s*(\S*).*/
iface = $1
else
warn "Could not find a default route. Using first non-loopback
interface"
end
if(iface != "")
output = %x{/sbin/ifconfig #{iface}}
else
output = %x{/sbin/ifconfig}
end
output.split(/^\S/).each do |str|
if str =~ /ether/ # we have an ethernet address on this interface
str =~ /ether (\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/
ether = $1
end
end
ether
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 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.