Class: BoxenFactsDirectoryLoader

Inherits:
Facter::Util::DirectoryLoader
  • Object
show all
Defined in:
lib/facter/boxen_facts_d.rb

Constant Summary collapse

EXTERNAL_FACT_WEIGHT =
Facter::Util::DirectoryLoader::EXTERNAL_FACT_WEIGHT + 1

Instance Method Summary collapse

Instance Method Details

#load(collection) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/facter/boxen_facts_d.rb', line 13

def load(collection)
  entries.each do |file|
    parser = Facter::Util::Parser.parser_for(file)
    if parser == nil
      next
    end

    data = parser.results
    if data == false
      Facter.warn "Could not interpret fact file #{file}"
    elsif data == {} or data == nil
      Facter.warn "Fact file #{file} was parsed but returned an empty data set"
    else
      data.each { |p,v| collection.add(p, :value => v) { has_weight(EXTERNAL_FACT_WEIGHT) } }
    end
  end
end