Sha256: aff80171389963432b2a2e48052bbff182488d98602a029098293979ba679689

Contents?: true

Size: 833 Bytes

Versions: 28

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

require 'win32/registry'

module Facter
  module Resolvers
    class NetKVM < BaseResolver
      @semaphore = Mutex.new
      @fact_list ||= {}
      class << self
        private

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

        def read_fact_from_registry(fact_name)
          reg = ::Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\\CurrentControlSet\\Services')
          build_fact_list(reg)
          reg.close

          @fact_list[fact_name]
        end

        def build_fact_list(reg)
          # rubocop:disable Performance/InefficientHashSearch
          @fact_list[:kvm] = reg.keys.include?('netkvm')
          # rubocop:enable Performance/InefficientHashSearch
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
facter-4.0.36 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.35 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.34 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.33 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.32 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.31 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.30 lib/facter/resolvers/windows/netkvm_resolver.rb
facter-4.0.29 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.28 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.26 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.25 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.24 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.23 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.22 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.21 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.20 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.19 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.18 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.17 lib/resolvers/windows/netkvm_resolver.rb
facter-4.0.16 lib/resolvers/windows/netkvm_resolver.rb