[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, experimental_upstream, updated. 1.5.9-54-g5a4eeed
Adrien Thebo
adrien at puppetlabs.com
Wed Jun 22 08:51:43 UTC 2011
The following commit has been merged in the experimental_upstream branch:
commit 56b5f10e876b29f9a2fd1906087ebb3cb5d47035
Author: Adrien Thebo <adrien at puppetlabs.com>
Date: Mon Mar 28 11:01:19 2011 -0700
(#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.
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 = []
--
Packaging of Facter for debian
More information about the Pkg-puppet-devel
mailing list