[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, experimental_upstream, updated. 1.5.9-54-g5a4eeed

Nick Lewis nick at puppetlabs.com
Wed Jun 22 08:51:54 UTC 2011


The following commit has been merged in the experimental_upstream branch:
commit 926e912cd4eeedacc5833457ed34e57bd06f5b1a
Author: Nick Lewis <nick at puppetlabs.com>
Date:   Tue May 31 13:25:43 2011 -0700

    (#7670) Stop preloading all facts in the application
    
    If a requested fact isn't found in the same location as its name, we want to
    load all of the facts to find it. However, to simplify that, we were previously
    just preloading all the facts every time. Because requesting a fact now
    implicitly loads all facts if necessary, we can rely on that, providing results
    much more quickly in the case where facts do match their filenames.
    
    Reviewed-By: Jacob Helwig <jacob at puppetlabs.com>

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'

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list