Sha256: 277bb7befeaa6a619bb33f1a3ac73d7ad12092950e12f5a9477f168682e4edfc

Contents?: true

Size: 1.77 KB

Versions: 36

Compression:

Stored size: 1.77 KB

Contents

# Fact: manufacturer
#
# Purpose: Return the hardware manufacturer information about the hardware.
#
# Resolution:
#   On OpenBSD, queries sysctl values, via a util class.
#   On SunOS Sparc, uses prtdiag via a util class.
#   On Windows, queries the system via a util class.
#   Uses the 'util/manufacturer.rb' for fallback parsing.
#
# Caveats:
#

# manufacturer.rb
# Facts related to hardware manufacturer
#
#

require 'facter/util/manufacturer'

if Facter.value(:kernel) == "OpenBSD"
  mfg_keys = {
    'hw.vendor'   => 'manufacturer',
    'hw.product'  => 'productname',
    'hw.serialno' => 'serialnumber'
  }

  Facter::Manufacturer.sysctl_find_system_info(mfg_keys)
elsif Facter.value(:kernel) == "Darwin"
  mfg_keys = {
    'hw.model'   => 'productname'
  }
  Facter::Manufacturer.sysctl_find_system_info(mfg_keys)
elsif Facter.value(:kernel) == "SunOS" and Facter.value(:hardwareisa) == "sparc"
  Facter::Manufacturer.prtdiag_sparc_find_system_info()
elsif Facter.value(:kernel) == "windows"
  win32_keys = {
    'manufacturer' => ['Manufacturer', 'Bios'],
    'serialNumber' => ['Serialnumber', 'Bios'],
    'productname'  => ['Name', 'ComputerSystemProduct']
  }
  Facter::Manufacturer.win32_find_system_info(win32_keys)
else
  query = {
    '[Bb]ase [Bb]oard [Ii]nformation' => [
      { 'Manufacturer:'    => 'boardmanufacturer' },
      { 'Product(?: Name)?:' => 'boardproductname' },
      { 'Serial Number:'   => 'boardserialnumber' }
    ],
    '[Ss]ystem [Ii]nformation' => [
      { 'Manufacturer:'    => 'manufacturer' },
      { 'Product(?: Name)?:' => 'productname' },
      { 'Serial Number:'   => 'serialnumber' }
    ],
    '(Chassis Information|system enclosure or chassis)' => [
      { '(?:Chassis )?Type:' => 'type' }
    ]
  }

  Facter::Manufacturer.dmi_find_system_info(query)
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/lib/facter/manufacturer.rb
facter-1.6.18 lib/facter/manufacturer.rb
facter-1.6.18.rc1 lib/facter/manufacturer.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/lib/facter/manufacturer.rb
facter-1.6.17 lib/facter/manufacturer.rb
facter-1.6.17.rc1 lib/facter/manufacturer.rb
facter-1.6.16 lib/facter/manufacturer.rb
facter-1.6.15 lib/facter/manufacturer.rb
facter-1.6.15.rc1 lib/facter/manufacturer.rb
facter-1.6.14 lib/facter/manufacturer.rb
facter-1.6.14.rc1 lib/facter/manufacturer.rb
facter-1.6.13 lib/facter/manufacturer.rb
facter-1.6.13.rc1 lib/facter/manufacturer.rb
facter-1.6.12 lib/facter/manufacturer.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/facter-1.6.11/lib/facter/manufacturer.rb
facter-1.6.12.rc2 lib/facter/manufacturer.rb
facter-1.6.12.rc1 lib/facter/manufacturer.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/manufacturer.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/facter-1.6.11/lib/facter/manufacturer.rb
facter-1.6.11 lib/facter/manufacturer.rb