Sha256: d013e4f42dc8fb744509c60b0bbeb983a143cd1d5735b0125b0c820861bd15f9

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 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 = {
    '[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

1 entries across 1 versions & 1 rubygems

Version Path
facter-1.6.2 lib/facter/manufacturer.rb