diff options
author | Luke Kanies <luke@madstop.com> | 2009-01-28 17:11:19 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-02-06 18:08:42 -0600 |
commit | fc14b81f99adc9c9308a26d322adaa59a7b7716d (patch) | |
tree | dc731383d3195e37ea3658b9cbc7b0c428579d9f /bin | |
parent | e8be6dcad2150769b51bf81e95c57491921e68c1 (diff) | |
download | puppet-fc14b81f99adc9c9308a26d322adaa59a7b7716d.tar.gz |
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 'bin')
-rwxr-xr-x | bin/puppetd | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/bin/puppetd b/bin/puppetd index ecea2d894..2a71a9a08 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -162,7 +162,8 @@ trap(:INT) do end require 'puppet' -require 'puppet/network/client' +require 'puppet/agent' +require 'puppet/configurer' require 'getoptlong' options = [ @@ -329,13 +330,19 @@ Puppet::SSL::Host.ca_location = :remote Puppet::Transaction::Report.terminus_class = :rest +Puppet::Resource::Catalog.terminus_class = :rest +Puppet::Resource::Catalog.cache_class = :yaml + +Puppet::Node::Facts.terminus_class = :facter +Puppet::Node::Facts.cache_class = :rest + # We need tomake the client either way, we just don't start it # if --no-client is set. -client = Puppet::Network::Client.master.new(args) +agent = Puppet::Agent.new(Puppet::Configurer) if options[:enable] - client.enable + agent.enable elsif options[:disable] - client.disable + agent.disable end if options[:enable] or options[:disable] @@ -347,12 +354,11 @@ server = nil # It'd be nice to daemonize later, but we have to daemonize before the # waitforcert happens. if Puppet[:daemonize] - client.daemonize + agent.daemonize end host = Puppet::SSL::Host.new cert = host.wait_for_cert(options[:waitforcert]) -client.recycle_connection objects = [] @@ -402,7 +408,7 @@ elsif options[:onetime] and Puppet[:listen] end if options[:client] - objects << client + objects << agent end # Set traps for INT and TERM @@ -417,10 +423,10 @@ if options[:onetime] end # Add the service, so the traps work correctly. - Puppet.newservice(client) + Puppet.newservice(agent) begin - client.run + agent.run rescue => detail if Puppet[:trace] puts detail.backtrace @@ -435,7 +441,7 @@ else if options[:client] Puppet.notice "Starting Puppet client version %s" % [Puppet.version] - Puppet.newservice(client) + Puppet.newservice(agent) end Puppet.settraps |