diff options
-rwxr-xr-x | bin/puppetd | 2 | ||||
-rw-r--r-- | lib/puppet/client.rb | 2 | ||||
-rw-r--r-- | test/client/client.rb | 21 |
3 files changed, 25 insertions, 0 deletions
diff --git a/bin/puppetd b/bin/puppetd index be2a4b328..5d6451e69 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -404,6 +404,8 @@ end # Set traps for INT and TERM Puppet.settraps +# If --onetime is specified, we don't run 'start', which means we don't +# create a pidfile. if options[:onetime] unless options[:client] $stderr.puts "onetime is specified but there is no client" diff --git a/lib/puppet/client.rb b/lib/puppet/client.rb index cf522a994..d8cc7ecff 100644 --- a/lib/puppet/client.rb +++ b/lib/puppet/client.rb @@ -9,6 +9,7 @@ module Puppet # but at least it's better organized for now class Client include Puppet + include Puppet::Daemon include Puppet::Util @@ -161,6 +162,7 @@ module Puppet # Start listening for events. We're pretty much just listening for # timer events here. def start + setpidfile() # Create our timer. Puppet will handle observing it and such. timer = Puppet.newtimer( :interval => Puppet[:runinterval], diff --git a/test/client/client.rb b/test/client/client.rb index 5bd947657..fa382392e 100644 --- a/test/client/client.rb +++ b/test/client/client.rb @@ -173,4 +173,25 @@ class TestClient < Test::Unit::TestCase assert_equal(%w{bootest yaytest}, classes.sort) end + + def test_setpidfile + $clientrun = false + newclass = Class.new(Puppet::Client) do + def run + $clientrun = true + end + + def initialize + end + end + + inst = newclass.new + + assert_nothing_raised { + inst.start + } + + assert(FileTest.exists?(inst.pidfile), + "PID file was not created") + end end |