blob: 8f52fefed360158dd83a84c9617aa88f3624bd90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# Fact: hardwaremodel
#
# Purpose:
# Returns the hardware model of the system.
#
# Resolution:
# Uses purely "uname -m" on all platforms other than AIX and Windows.
# On AIX uses the parsed "modelname" output of "lsattr -El sys0 -a modelname".
# On Windows uses the 'host_cpu' pulled out of Ruby's config.
#
# Caveats:
#
Facter.add(:hardwaremodel) do
setcode 'uname -m'
end
Facter.add(:hardwaremodel) do
confine :operatingsystem => :aix
setcode do
model = Facter::Util::Resolution.exec('lsattr -El sys0 -a modelname')
if model =~ /modelname\s(\S+)\s/
$1
end
end
end
Facter.add(:hardwaremodel) do
confine :operatingsystem => :windows
setcode do
require 'rbconfig'
Config::CONFIG['host_cpu']
end
end
|