summaryrefslogtreecommitdiffstats
path: root/lib/puppet/agent/fact_handler.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-01-28 17:11:19 -0600
committerLuke Kanies <luke@madstop.com>2009-02-06 18:08:42 -0600
commitfc14b81f99adc9c9308a26d322adaa59a7b7716d (patch)
treedc731383d3195e37ea3658b9cbc7b0c428579d9f /lib/puppet/agent/fact_handler.rb
parente8be6dcad2150769b51bf81e95c57491921e68c1 (diff)
downloadpuppet-fc14b81f99adc9c9308a26d322adaa59a7b7716d.tar.gz
puppet-fc14b81f99adc9c9308a26d322adaa59a7b7716d.tar.xz
puppet-fc14b81f99adc9c9308a26d322adaa59a7b7716d.zip
Splitting the Agent class into Agent and Configurer
Once I went to add runinterval support to the Agent class, I realized it's really two classes: One that handles starting, stopping, running, et al (still called Agent), and one that handles downloading the catalog, running it, etc. (now called Configurer). This commit includes some additional code, but 95% of it is just moving code around. 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.rb48
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/puppet/agent/fact_handler.rb b/lib/puppet/agent/fact_handler.rb
deleted file mode 100644
index 266ae1815..000000000
--- a/lib/puppet/agent/fact_handler.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-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.
-module Puppet::Agent::FactHandler
- def download_fact_plugins?
- Puppet[:factsync]
- end
-
- def upload_facts
- # XXX down = Puppet[:downcasefacts]
-
- reload_facter()
-
- # This works because puppetd configures Facts to use 'facter' for
- # finding facts and the 'rest' terminus for caching them. Thus, we'll
- # compile them and then "cache" them on the server.
- Puppet::Node::Facts.find(Puppet[:certname])
- end
-
- # Retrieve facts from the central server.
- def download_fact_plugins
- return unless download_fact_plugins?
-
- Puppet::Agent::Downloader.new("fact", Puppet[:factsource], Puppet[:factdest], Puppet[:factsignore]).evaluate
- 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.
- def reload_facter
- Facter.clear
-
- # Reload everything.
- if Facter.respond_to? :loadfacts
- Facter.loadfacts
- elsif Facter.respond_to? :load
- Facter.load
- else
- Puppet.warning "You should upgrade your version of Facter to at least 1.3.8"
- end
-
- # This loads all existing facts and any new ones. We have to remove and
- # reload because there's no way to unload specific facts.
- Puppet::Node::Facts::Facter.load_fact_plugins()
- end
-end