diff options
| author | Luke Kanies <luke@madstop.com> | 2009-01-22 16:51:02 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-06 18:08:41 -0600 |
| commit | e65d7f11dd95ab5432adefeabc3179e9eb5dd050 (patch) | |
| tree | 52ad7eabbe7b07d5f7496587e40019cbe4e3a76e /lib/puppet/agent/fact_handler.rb | |
| parent | 6b4e5f49a8d1d062aefae31a923cff9e3f0d31ba (diff) | |
| download | puppet-e65d7f11dd95ab5432adefeabc3179e9eb5dd050.tar.gz puppet-e65d7f11dd95ab5432adefeabc3179e9eb5dd050.tar.xz puppet-e65d7f11dd95ab5432adefeabc3179e9eb5dd050.zip | |
Refactoring how the Facter integration works
I moved all of the extra Fact modifications into the Facts
class, and then moved the calls of those new methods
into the Facter terminus.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/agent/fact_handler.rb')
| -rw-r--r-- | lib/puppet/agent/fact_handler.rb | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/lib/puppet/agent/fact_handler.rb b/lib/puppet/agent/fact_handler.rb index 4c9280bfc..266ae1815 100644 --- a/lib/puppet/agent/fact_handler.rb +++ b/lib/puppet/agent/fact_handler.rb @@ -1,3 +1,5 @@ +require 'puppet/indirector/facts/facter' + # Break out the code related to facts. This module is # just included into the agent, but having it here makes it # easier to test. @@ -24,31 +26,6 @@ module Puppet::Agent::FactHandler Puppet::Agent::Downloader.new("fact", Puppet[:factsource], Puppet[:factdest], Puppet[:factsignore]).evaluate end - def load_fact_plugins - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] - x = Puppet[:factpath].split(":").each do |dir| - load_facts_in_dir(dir) - end - end - - def load_facts_in_dir(dir) - return unless FileTest.directory?(dir) - - Dir.chdir(dir) do - Dir.glob("*.rb").each do |file| - fqfile = ::File.join(dir, file) - begin - Puppet.info "Loading facts in %s" % [::File.basename(file.sub(".rb",''))] - Timeout::timeout(Puppet::Agent.timeout) do - load file - end - rescue => detail - Puppet.warning "Could not load fact file %s: %s" % [fqfile, detail] - end - end - end - end - # Clear out all of the loaded facts and reload them from disk. # NOTE: This is clumsy and shouldn't be required for later (1.5.x) versions # of Facter. @@ -66,6 +43,6 @@ module Puppet::Agent::FactHandler # This loads all existing facts and any new ones. We have to remove and # reload because there's no way to unload specific facts. - load_fact_plugins() + Puppet::Node::Facts::Facter.load_fact_plugins() end end |
