summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2006-09-19 06:50:21 +0000
committerluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2006-09-19 06:50:21 +0000
commit4abbce9119f91179aaa7aeb2f92466cc201a9079 (patch)
tree61895d612b590c83977d41a8c34c795c0f48f399 /lib
parent7407e0c26dc5b4f12398393bf5f0173fb8685ff4 (diff)
downloadfacter-4abbce9119f91179aaa7aeb2f92466cc201a9079.tar.gz
facter-4abbce9119f91179aaa7aeb2f92466cc201a9079.tar.xz
facter-4abbce9119f91179aaa7aeb2f92466cc201a9079.zip
applying patch from #18.
git-svn-id: http://reductivelabs.com/svn/facter/trunk@169 1f5c1d6a-bddf-0310-8f58-fc49e503516a
Diffstat (limited to 'lib')
-rw-r--r--lib/facter.rb42
1 files changed, 16 insertions, 26 deletions
diff --git a/lib/facter.rb b/lib/facter.rb
index f1726cc..8a9fcc1 100644
--- a/lib/facter.rb
+++ b/lib/facter.rb
@@ -651,11 +651,13 @@ class Facter
end
Facter.add("Architecture") do
- confine :operatingsystem => :debian
+ confine :kernel => :linux
setcode do
model = Facter.hardwaremodel
case model
- when 'x86_64': "amd64"
+ # most linuxen use "x86_64"
+ when 'x86_64':
+ Facter.operatingsystem == "Debian" ? "amd64" : model;
when /(i[3456]86|pentium)/: "i386"
else
model
@@ -848,24 +850,25 @@ class Facter
Facter.add("UniqueId") do
setcode 'hostid', '/bin/sh'
- confine :operatingsystem => :solaris
+ #confine :kernel => %w{Solaris Linux}
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo}
end
Facter.add("HardwareISA") do
setcode 'uname -p', '/bin/sh'
- confine :operatingsystem => :solaris
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo}
end
Facter.add("MacAddress") do
- confine :operatingsystem => %w{FreeBSD NetBSD OpenBSD solaris}
+ #confine :kernel => %w{Solaris Linux}
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo}
setcode do
- ether = nil
+ ether = []
output = %x{/sbin/ifconfig -a}
-
- output =~ /ether (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/
- ether = $1
-
- ether
+ output.each {|s|
+ ether.push($1) if s =~ /(?:ether|HWaddr) (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/
+ }
+ ether.join(" ")
end
end
@@ -885,20 +888,6 @@ class Facter
ether
end
- Facter.add("MacAddress") do
- confine :kernel => :linux
- setcode do
- ether = nil
- output = %x{/sbin/ifconfig -a}
-
- output =~ /HWaddr (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/
- ether = $1
-
- ether
- end
- end
-
-
Facter.add("IPAddress") do
confine :kernel => :linux
setcode do
@@ -973,7 +962,8 @@ class Facter
end
Facter.add("id") do
- confine :operatingsystem => :linux
+ #confine :kernel => %w{Solaris Linux}
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo}
setcode "whoami"
end