Sha256: bc731d13bfa1f9431343873ecd520df154b39a598682ae8fb0d2b394709a8149

Contents?: true

Size: 874 Bytes

Versions: 26

Compression:

Stored size: 874 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.filter_tokens = []
        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

26 entries across 26 versions & 1 rubygems

Version Path
facter-4.1.1 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.1.0 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.52 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.51 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.50 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.49 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.48 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.47 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.46 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.44 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.43 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.42 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.41 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.40 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.39 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.38 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.37 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.36 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.35 lib/facter/framework/core/fact/external/external_fact_manager.rb
facter-4.0.34 lib/facter/framework/core/fact/external/external_fact_manager.rb