Sha256: 662048e3950b2e697a7a8dd6d37138330f2f26ffcc29c4aa64d620b2eecffea7

Contents?: true

Size: 1020 Bytes

Versions: 32

Compression:

Stored size: 1020 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class DMIComputerSystem < BaseResolver
      @log = Facter::Log.new(self)
      init_resolver

      class << self
        # Name
        # UUID

        private

        def post_resolve(fact_name, _options)
          @fact_list.fetch(fact_name) { read_fact_from_computer_system(fact_name) }
        end

        def read_fact_from_computer_system(fact_name)
          win = Facter::Util::Windows::Win32Ole.new
          computersystem = win.return_first('SELECT Name,UUID FROM Win32_ComputerSystemProduct')
          unless computersystem
            @log.debug 'WMI query returned no results for Win32_ComputerSystemProduct with values Name and UUID.'
            return
          end

          build_fact_list(computersystem)

          @fact_list[fact_name]
        end

        def build_fact_list(computersys)
          @fact_list[:name] = computersys.Name
          @fact_list[:uuid] = computersys.UUID
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
facter-4.7.0 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.6.1 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.6.0 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.5.2 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.5.1 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.5.0 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.4.3 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.4.2 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.4.1 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.4.0 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.3.1 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.3.0 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.14 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.13 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.12 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.11 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.10 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.9 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.8 lib/facter/resolvers/windows/dmi_computersystem.rb
facter-4.2.7 lib/facter/resolvers/windows/dmi_computersystem.rb