class Facter::Resolvers::DMIBios

Private Class Methods

build_fact_list(bios) click to toggle source
# File lib/facter/resolvers/windows/dmi_bios.rb, line 32
def build_fact_list(bios)
  @fact_list[:manufacturer] = bios.Manufacturer
  @fact_list[:serial_number] = bios.SerialNumber
end
post_resolve(fact_name, _options) click to toggle source

Manufacturer SerialNumber

# File lib/facter/resolvers/windows/dmi_bios.rb, line 14
def post_resolve(fact_name, _options)
  @fact_list.fetch(fact_name) { read_fact_from_bios(fact_name) }
end
read_fact_from_bios(fact_name) click to toggle source
# File lib/facter/resolvers/windows/dmi_bios.rb, line 18
def read_fact_from_bios(fact_name)
  win = Facter::Util::Windows::Win32Ole.new

  bios = win.return_first('SELECT Manufacturer,SerialNumber from Win32_BIOS')
  unless bios
    @log.debug 'WMI query returned no results for Win32_BIOS with values Manufacturer and SerialNumber.'
    return
  end

  build_fact_list(bios)

  @fact_list[fact_name]
end