summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-05-31 15:37:30 -0700
committerNick Lewis <nick@puppetlabs.com>2011-05-31 15:37:30 -0700
commit97927e321d1e24554ad21b92ef4afb1bd64c0167 (patch)
treedf2f82066114918911670749887812674e4a72e1 /lib
parent59173268a5c6525a4a5df55b362775d07bc6b52d (diff)
parent9404a7a3bb8da660e26897d052cdd03c291fb0bb (diff)
downloadfacter-master.tar.gz
facter-master.tar.xz
facter-master.zip
Merge branch 'ticket/master/7670'HEADmaster
Diffstat (limited to 'lib')
-rw-r--r--lib/facter/application.rb7
-rw-r--r--lib/facter/util/collection.rb6
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/facter/application.rb b/lib/facter/application.rb
index bd68149..9b6da1d 100644
--- a/lib/facter/application.rb
+++ b/lib/facter/application.rb
@@ -10,10 +10,6 @@ module Facter
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|
@@ -26,6 +22,9 @@ module Facter
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'
diff --git a/lib/facter/util/collection.rb b/lib/facter/util/collection.rb
index 3f8e0f8..b3d3a45 100644
--- a/lib/facter/util/collection.rb
+++ b/lib/facter/util/collection.rb
@@ -66,9 +66,13 @@ class Facter::Util::Collection
def fact(name)
name = canonize(name)
+ # Try to load the fact if necessary
loader.load(name) unless @facts[name]
- return @facts[name]
+ # Try HARDER
+ loader.load_all unless @facts[name]
+
+ @facts[name]
end
# Flush all cached values.