Sha256: c3a0814e666b2f02a0124ff9f6609beca26947b69a3a29808c2f2235b04db400

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

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

      init_resolver

      class << self
        private

        def post_resolve(fact_name)
          @fact_list.fetch(fact_name) { read_from_ole(fact_name) }
        end

        def read_from_ole(fact_name)
          win = Facter::Util::Windows::Win32Ole.new
          op_sys = win.return_first('SELECT ProductType,OtherTypeDescription FROM Win32_OperatingSystem')
          unless op_sys
            @log.debug 'WMI query returned no results for Win32_OperatingSystem'\
                       'with values ProductType and OtherTypeDescription.'
            return
          end
          @fact_list[:consumerrel] = (op_sys.ProductType == 1)
          @fact_list[:description] = op_sys.OtherTypeDescription
          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facter-4.0.49 lib/facter/resolvers/windows/win_os_description.rb
facter-4.0.48 lib/facter/resolvers/windows/win_os_description.rb
facter-4.0.47 lib/facter/resolvers/windows/win_os_description_resolver.rb