lib/facter/application.rb in facter-1.5.9 vs lib/facter/application.rb in facter-1.6.0

- old
+ new

@@ -8,14 +8,10 @@ # Accept fact names to return from the command line names = argv # Create the facts hash that is printed to standard out. - # Pre-load all of the facts, since we can have multiple facts - # per file, and since we can't know ahead of time which file a - # fact will be in, we'll need to load every file. - facts = Facter.to_hash unless names.empty? facts = {} names.each do |name| begin facts[name] = Facter.value(name) @@ -23,9 +19,12 @@ $stderr.puts "Could not retrieve #{name}: #{error}" exit 10 end end end + + # Print everything if they didn't ask for specific facts. + facts ||= Facter.to_hash # Print the facts as YAML and exit if options[:yaml] require 'yaml' puts YAML.dump(facts)