Sha256: 4995f5df983a8a1b3e113925198da16a97a4b72a1ca7237ef5f3a0c98fe776b0

Contents?: true

Size: 1.99 KB

Versions: 37

Compression:

Stored size: 1.99 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' }
    ],
    '[Bb][Ii][Oo][Ss] [Ii]nformation' => [
      { '[Vv]endor:' => 'bios_vendor' },
      { '[Vv]ersion:' => 'bios_version' },
      { '[Rr]elease [Dd]ate:' => 'bios_release_date' }
    ],
    '[Ss]ystem [Ii]nformation' => [
      { 'Manufacturer:'    => 'manufacturer' },
      { 'Product(?: Name)?:' => 'productname' },
      { 'Serial Number:'   => 'serialnumber' },
      { 'UUID:'   => 'uuid' }
    ],
    '(Chassis Information|system enclosure or chassis)' => [
      { '(?:Chassis )?Type:' => 'type' }
    ]
  }

  Facter::Manufacturer.dmi_find_system_info(query)
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
facter-2.0.1.rc1 lib/facter/manufacturer.rb
facter-2.0.1.rc1-x86-mingw32 lib/facter/manufacturer.rb
facter-2.0.1.rc1-universal-darwin lib/facter/manufacturer.rb
facter-1.7.5 lib/facter/manufacturer.rb
facter-1.7.5.rc2 lib/facter/manufacturer.rb
facter-1.7.5.rc1 lib/facter/manufacturer.rb
facter-1.7.4 lib/facter/manufacturer.rb
facter-1.7.4.rc1 lib/facter/manufacturer.rb
facter-1.7.3 lib/facter/manufacturer.rb
facter-1.7.3.rc1 lib/facter/manufacturer.rb
facter-1.7.2 lib/facter/manufacturer.rb
facter-1.7.2.rc1 lib/facter/manufacturer.rb
facter-1.7.1 lib/facter/manufacturer.rb
facter-1.7.1.rc1 lib/facter/manufacturer.rb
facter-1.7.0 lib/facter/manufacturer.rb
facter-1.7.0.rc2 lib/facter/manufacturer.rb
facter-1.7.0.rc1 lib/facter/manufacturer.rb