Sha256: ba18a8159d90db65dc8224154ec377086af16c5a0bd7b1cb4cd18f14d700198e

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

# 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-1.6.1 lib/facter/hardwaremodel.rb
facter-1.6.0 lib/facter/hardwaremodel.rb