This will need to be modified on the merge into 0.25,
because the daemon module becomes a class, but that should
be easy enough.

Signed-off-by: Luke Kanies <[email protected]>
---
 lib/puppet/application/puppetqd.rb |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 bin/puppetqd

diff --git a/bin/puppetqd b/bin/puppetqd
old mode 100644
new mode 100755
diff --git a/lib/puppet/application/puppetqd.rb 
b/lib/puppet/application/puppetqd.rb
index ce8ad5a..2f2e703 100644
--- a/lib/puppet/application/puppetqd.rb
+++ b/lib/puppet/application/puppetqd.rb
@@ -1,4 +1,5 @@
 require 'puppet'
+require 'puppet/daemon'
 require 'puppet/application'
 require 'puppet/node/catalog'
 require 'puppet/indirector/catalog/queue'
@@ -30,7 +31,18 @@ class Puppet::Util::Settings::CElement
     end
 end
 
+class Puppet::Util::Settings::CBoolean
+    def optparse_args
+        if short
+            ["--[no-]#{name}", "-#{short}", desc, :NONE ]
+        else
+            ["--[no-]#{name}", desc, :NONE]
+        end
+    end
+end
+
 Puppet::Application.new(:puppetqd) do
+    extend Puppet::Daemon
 
     should_parse_config
 
@@ -59,8 +71,12 @@ Puppet::Application.new(:puppetqd) do
             # Once you have a Puppet::Node::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)
+            Puppet.notice "Processing queued catalog for %s" % catalog.name
             catalog.save
         end
+        daemonize if Puppet[:daemonize]
+
+        while true do sleep 1000 end
     end
 
     # This is the main application entry point.
@@ -68,7 +84,7 @@ Puppet::Application.new(:puppetqd) do
     def run
         run_preinit
         parse_options
-        Puppet.settings.parse(Puppet[:config]) if should_parse_config?
+        Puppet.settings.parse(Puppet[:config]) if should_parse_config? and 
File.exist?(Puppet[:config])
         run_setup
         run_command
     end
-- 
1.6.1


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to