diff options
author | Adrien Thebo <adrien@puppetlabs.com> | 2011-03-28 11:01:19 -0700 |
---|---|---|
committer | Adrien Thebo <adrien.thebo@gmail.com> | 2011-04-01 18:19:11 -0700 |
commit | d6967a0630dec168059316426b0eb4228b27e451 (patch) | |
tree | fa6ef955a33880054f40d17557a08e2ef9337ebb /lib | |
parent | e056218cc6f7fd7a40923ec6472d6020e220a81f (diff) | |
download | facter-d6967a0630dec168059316426b0eb4228b27e451.tar.gz facter-d6967a0630dec168059316426b0eb4228b27e451.tar.xz facter-d6967a0630dec168059316426b0eb4228b27e451.zip |
(#6613) Switch solaris macaddress fact to netstat
- ifconfig on solaris will only return the mac address if run as root.
netstat -np will provide the information to any user.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/macaddress.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb index 4a12384..bf23ef6 100644 --- a/lib/facter/macaddress.rb +++ b/lib/facter/macaddress.rb @@ -13,6 +13,18 @@ Facter.add(:macaddress) do end Facter.add(:macaddress) do + confine :operatingsystem => "Solaris" + setcode do + ether = [] + output = Facter::Util::Resolution.exec("/usr/bin/netstat -np") + output.each_line do |s| + ether.push($1) if s =~ /(?:SPLA)\s+(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/ + end + ether[0] + end +end + +Facter.add(:macaddress) do confine :operatingsystem => %w{FreeBSD OpenBSD} setcode do ether = [] |