diff options
-rwxr-xr-x | bin/puppet | 14 | ||||
-rwxr-xr-x | bin/puppetd | 10 | ||||
-rwxr-xr-x | bin/puppetmasterd | 10 | ||||
-rwxr-xr-x | ext/module_puppet | 14 |
4 files changed, 41 insertions, 7 deletions
diff --git a/bin/puppet b/bin/puppet index 9fcbfe372..b39a5160b 100755 --- a/bin/puppet +++ b/bin/puppet @@ -142,6 +142,20 @@ rescue GetoptLong::InvalidOption => detail exit(1) end +client = nil +server = nil + +[:INT, :TERM].each do |signal| + trap(signal) do + Puppet.notice "Caught #{signal}; shutting down" + [client, server].each { |obj| + if obj + obj.shutdown + end + } + end +end + if debug Puppet::Log.level = :debug elsif verbose diff --git a/bin/puppetd b/bin/puppetd index fb8759057..2fabccd69 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -278,10 +278,12 @@ end # now set up the network client with the certs, now that we have them client.setcerts -trap(:INT) { - Puppet.notice "Caught INT; shutting down" - client.shutdown -} +[:INT, :TERM].each do |signal| + trap(signal) do + Puppet.notice "Caught #{signal}; shutting down" + client.shutdown + end +end if onetime begin diff --git a/bin/puppetmasterd b/bin/puppetmasterd index 3f235b179..3ae74f73b 100755 --- a/bin/puppetmasterd +++ b/bin/puppetmasterd @@ -221,9 +221,13 @@ if args[:Daemonize] server.daemonize end -trap(:INT) { - server.shutdown -} + +[:INT, :TERM].each do |signal| + trap(signal) do + Puppet.notice "Caught #{signal}; shutting down" + server.shutdown + end +end Puppet.notice "Starting Puppet server version %s" % [Puppet.version] diff --git a/ext/module_puppet b/ext/module_puppet index 542b93207..489cc37ba 100755 --- a/ext/module_puppet +++ b/ext/module_puppet @@ -132,6 +132,20 @@ if Puppet[:config] and File.exists? Puppet[:config] Puppet.config.parse(Puppet[:config]) end +client = nil +server = nil + +[:INT, :TERM].each do |signal| + trap(signal) do + Puppet.notice "Caught #{signal}; shutting down" + [client, server].each { |obj| + if obj + obj.shutdown + end + } + end +end + Puppet.genconfig Puppet.genmanifest |