Sha256: 56b9179a071240fbb6082e2f9a80bdd1d98b52524e1e94b20d27372eb72532e5

Contents?: true

Size: 752 Bytes

Versions: 20

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class BaseResolver
      def self.log
        @log ||= Log.new(self)
      end

      def self.invalidate_cache
        @fact_list = {}
      end

      def self.subscribe_to_manager
        Facter::SessionCache.subscribe(self)
      end

      def self.resolve(fact_name)
        @semaphore.synchronize do
          subscribe_to_manager
          post_resolve(fact_name)
        end
      rescue LoadError => e
        log.debug("resolving fact #{fact_name}, but #{e}")
        @fact_list[fact_name] = nil
      end

      def self.post_resolve(_fact_name)
        raise NotImplementedError, "You must implement post_resolve(fact_name) method in #{name}"
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
facter-4.0.34 lib/facter/resolvers/base_resolver.rb
facter-4.0.33 lib/facter/resolvers/base_resolver.rb
facter-4.0.32 lib/facter/resolvers/base_resolver.rb
facter-4.0.31 lib/facter/resolvers/base_resolver.rb
facter-4.0.30 lib/facter/resolvers/base_resolver.rb
facter-4.0.29 lib/resolvers/base_resolver.rb
facter-4.0.28 lib/resolvers/base_resolver.rb
facter-4.0.26 lib/resolvers/base_resolver.rb
facter-4.0.25 lib/resolvers/base_resolver.rb
facter-4.0.24 lib/resolvers/base_resolver.rb
facter-4.0.23 lib/resolvers/base_resolver.rb
facter-4.0.22 lib/resolvers/base_resolver.rb
facter-4.0.21 lib/resolvers/base_resolver.rb
facter-4.0.20 lib/resolvers/base_resolver.rb
facter-4.0.19 lib/resolvers/base_resolver.rb
facter-4.0.18 lib/resolvers/base_resolver.rb
facter-4.0.17 lib/resolvers/base_resolver.rb
facter-4.0.16 lib/resolvers/base_resolver.rb
facter-4.0.15 lib/resolvers/base_resolver.rb
facter-4.0.14 lib/resolvers/base_resolver.rb