Sha256: 2754ce08b34c24ab88098958091d9b6b85231602503a63cfe219532258f7f921
Contents?: true
Size: 956 Bytes
Versions: 8
Compression:
Stored size: 956 Bytes
Contents
# frozen_string_literal: true module Facter module Resolvers class DMIBios < BaseResolver @log = Facter::Log.new(self) @fact_list ||= {} class << self # Manufacturer # SerialNumber private def post_resolve(fact_name) @fact_list.fetch(fact_name) { read_fact_from_bios(fact_name) } end def read_fact_from_bios(fact_name) win = 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 def build_fact_list(bios) @fact_list[:manufacturer] = bios.Manufacturer @fact_list[:serial_number] = bios.SerialNumber end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems