diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-04-30 16:05:43 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1 (patch) | |
tree | 6ff89deef467aa58b8b50ea06200b5d2f2dc97ac /lib/puppet/application/queue.rb | |
parent | 7656ba73ddfd883b36a01c81147ae69e80773bce (diff) | |
download | puppet-d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1.tar.gz puppet-d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1.tar.xz puppet-d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1.zip |
Refactor #3706 Reify eigenclasses of Applications
The Puppet::Application DSL is complicated by the fact that it operates
on eigenclasses of instances of Puppet::Application, rather than
subclassing it.
This patch reifies the eigenclasses as subclasses of
Puppet::Application.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet/application/queue.rb')
-rw-r--r-- | lib/puppet/application/queue.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 13fb3e107..4b3aa57b5 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -5,13 +5,12 @@ require 'puppet/resource/catalog' require 'puppet/indirector/catalog/queue' require 'puppet/util' -Puppet::Application.new(:queue) do - extend Puppet::Util +class Puppet::Application::Queue < Puppet::Application should_parse_config attr_accessor :daemon - preinit do + def preinit @daemon = Puppet::Daemon.new @daemon.argv = ARGV.dup Puppet::Util::Log.newdestination(:console) @@ -41,13 +40,13 @@ Puppet::Application.new(:queue) do option("--debug","-d") option("--verbose","-v") - command(:main) do + def main Puppet.notice "Starting puppetqd %s" % Puppet.version Puppet::Resource::Catalog::Queue.subscribe do |catalog| # Once you have a Puppet::Resource::Catalog instance, calling save() on it should suffice # to put it through to the database via its active_record indirector (which is determined # by the terminus_class = :active_record setting above) - benchmark(:notice, "Processing queued catalog for %s" % catalog.name) do + Puppet::Util.benchmark(:notice, "Processing queued catalog for %s" % catalog.name) do begin catalog.save rescue => detail @@ -72,7 +71,7 @@ Puppet::Application.new(:queue) do end end - setup do + def setup unless Puppet.features.stomp? raise ArgumentError, "Could not load the 'stomp' library, which must be present for queueing to work. You must install the required library." end |