Sha256: 888b93c337ac8e607e8a594042eedeb3a29dbd340b138e78390cace22135d90c

Contents?: true

Size: 1012 Bytes

Versions: 18

Compression:

Stored size: 1012 Bytes

Contents

# frozen_string_literal: true

module Facter
  class ExternalFactLoader
    def custom_facts
      @custom_facts = load_custom_facts
    end

    def external_facts
      @external_facts = load_external_facts
    end

    def all_facts
      @all_facts ||= Utils.deep_copy(custom_facts + external_facts)
    end

    private

    def load_custom_facts
      custom_facts = []

      custom_facts_to_load = LegacyFacter.collection.custom_facts

      custom_facts_to_load&.each do |custom_fact_name|
        loaded_fact = LoadedFact.new(custom_fact_name.to_s, nil, :custom)
        custom_facts << loaded_fact
      end

      custom_facts
    end

    def load_external_facts
      external_facts = []

      external_facts_to_load = LegacyFacter.collection.external_facts

      external_facts_to_load&.each do |k, v|
        loaded_fact = LoadedFact.new(k.to_s, nil, :external)
        loaded_fact.file = v.options[:file]
        external_facts << loaded_fact
      end

      external_facts
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
facter-4.0.46 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.44 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.43 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.42 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.41 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.40 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.39 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.38 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.37 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.36 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.35 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.34 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.33 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.32 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.31 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.30 lib/facter/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.29 lib/framework/core/fact_loaders/external_fact_loader.rb
facter-4.0.28 lib/framework/core/fact_loaders/external_fact_loader.rb