Sha256: 666ce22e105f37a07b8b89725e721d9bfa80cde2051b8afca5408f5a899d18f5
Contents?: true
Size: 751 Bytes
Versions: 5
Compression:
Stored size: 751 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' RbConfig::CONFIG['host_cpu'] end end
Version data entries
5 entries across 5 versions & 1 rubygems