Sha256: a4bf7f9dbd24c6519c1ef95358262abf503ffc6886358d26e048972e27b9d99d

Contents?: true

Size: 833 Bytes

Versions: 31

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

module Facter
  class ExternalFactManager
    def resolve_facts(searched_facts)
      searched_facts = filter_external_facts(searched_facts)
      external_facts(searched_facts)
    end

    private

    def filter_external_facts(searched_facts)
      searched_facts.select { |searched_fact| %i[custom external].include?(searched_fact.type) }
    end

    def external_facts(custom_facts)
      resolved_custom_facts = []

      custom_facts.each do |custom_fact|
        fact = LegacyFacter[custom_fact.name]
        resolved_fact = ResolvedFact.new(custom_fact.name, fact.value, :custom)
        resolved_fact.user_query = custom_fact.user_query
        resolved_fact.file = fact.options[:file]

        resolved_custom_facts << resolved_fact
      end

      resolved_custom_facts
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
facter-4.2.10 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.9 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.8 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.7 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.6 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.5 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.4 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.3 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.2 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.1 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.2.0 lib/facter/framework/core/fact/external/external_fact_manager.rb