Sha256: 474a8449e012e6a6740f2691bff292b4ce09e584e803e3e8d0d07be42d769990

Contents?: true

Size: 749 Bytes

Versions: 13

Compression:

Stored size: 749 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

13 entries across 13 versions & 2 rubygems

Version Path
supply_drop-0.11.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.9.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.8.1 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.8.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.7.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.6.1 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
supply_drop-0.6.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/hardwaremodel.rb
facter-1.6.4 lib/facter/hardwaremodel.rb
facter-1.6.3 lib/facter/hardwaremodel.rb
facter-1.6.2 lib/facter/hardwaremodel.rb