summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-05-02 17:33:59 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-05-04 07:38:44 +1000
commit2dd55fcc542b935146f4eb385356fee0d7d3ea2a (patch)
treea69e50bc953f4af7afa976b177ebb89b45069537 /lib/puppet
parentc016062706d541a6255303db0624c8d96d31cfd6 (diff)
downloadpuppet-2dd55fcc542b935146f4eb385356fee0d7d3ea2a.tar.gz
puppet-2dd55fcc542b935146f4eb385356fee0d7d3ea2a.tar.xz
puppet-2dd55fcc542b935146f4eb385356fee0d7d3ea2a.zip
Fixing #2200 - puppetqd expects Daemon to be a class
I *swear* I wrote tests for the daemon, but I can't find them in any of my branches so I rewrote them. In the course of writing them, I also fixed the usage of Daemon. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/application/puppetqd.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/puppet/application/puppetqd.rb b/lib/puppet/application/puppetqd.rb
index 9d2740a81..05bb21fe9 100644
--- a/lib/puppet/application/puppetqd.rb
+++ b/lib/puppet/application/puppetqd.rb
@@ -5,11 +5,14 @@ require 'puppet/resource/catalog'
require 'puppet/indirector/catalog/queue'
Puppet::Application.new(:puppetqd) do
- extend Puppet::Daemon
-
should_parse_config
+ attr_accessor :daemon
+
preinit do
+ @daemon = Puppet::Daemon.new
+ @daemon.argv = ARGV.dup
+
# Do an initial trap, so that cancels don't get a stack trace.
trap(:INT) do
$stderr.puts "Cancelling startup"
@@ -22,8 +25,6 @@ Puppet::Application.new(:puppetqd) do
}.each do |opt,val|
options[opt] = val
end
-
- @args = {}
end
option("--debug","-d")
@@ -37,9 +38,8 @@ Puppet::Application.new(:puppetqd) do
Puppet.notice "Processing queued catalog for %s" % catalog.name
catalog.save
end
- daemonize if Puppet[:daemonize]
- while true do sleep 1000 end
+ sleep_forever()
end
# Handle the logging settings.
@@ -52,10 +52,6 @@ Puppet::Application.new(:puppetqd) do
Puppet::Util::Log.level = :info
end
end
-
- unless options[:setdest]
- Puppet::Util::Log.newdestination(:syslog)
- end
end
setup do
@@ -70,5 +66,11 @@ Puppet::Application.new(:puppetqd) do
end
Puppet::Resource::Catalog.terminus_class = :active_record
+
+ daemon.daemonize if Puppet[:daemonize]
+ end
+
+ def sleep_forever
+ while true do sleep 1000 end
end
end