summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-01-21 16:03:26 -0800
committerJames Turnbull <james@lovedthanlost.net>2010-01-24 07:29:49 +1100
commita91c476387887baa5920f5539a7c4acfaf8cecd9 (patch)
treef60946f17d929bf7037ec4dd5102e3e04878913a /lib/puppet/util
parent1a263e27dede28d3844a4f010ab6ce42ef2977b0 (diff)
Fix for #3088 (catching Exception also traps SystemExit)
Changing rescues from the default to Exception (to catch errors that don't descend from StandardError) had the unintended consequence of catching (and suppressing) SystemExit. This patch restores the behavior of by reraising the exception. Of the other exceptions that fall through the same crack (NoMemoryError, SignalException, LoadError, Interrupt, NotImplementedError, and ScriptError) this patch also reraises NoMemoryError, SignalException, and Interrupt in the same way and leaves the rest captured.
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/autoload.rb4
-rw-r--r--lib/puppet/util/feature.rb2
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb
index ec2f48c7b..142ff293f 100644
--- a/lib/puppet/util/autoload.rb
+++ b/lib/puppet/util/autoload.rb
@@ -86,6 +86,8 @@ class Puppet::Util::Autoload
name = symbolize(name)
loaded name, file
return true
+ rescue SystemExit,NoMemoryError,SignalException,Interrupt
+ raise
rescue Exception => detail
# I have no idea what's going on here, but different versions
# of ruby are raising different errors on missing files.
@@ -123,6 +125,8 @@ class Puppet::Util::Autoload
begin
Kernel.require file
loaded(name, file)
+ rescue SystemExit,NoMemoryError,SignalException,Interrupt
+ raise
rescue Exception => detail
if Puppet[:trace]
puts detail.backtrace
diff --git a/lib/puppet/util/feature.rb b/lib/puppet/util/feature.rb
index add1b2691..8f77a2724 100644
--- a/lib/puppet/util/feature.rb
+++ b/lib/puppet/util/feature.rb
@@ -83,6 +83,8 @@ class Puppet::Util::Feature
begin
require lib
+ rescue SystemExit,NoMemoryError,SignalException,Interrupt
+ raise
rescue Exception
Puppet.debug "Failed to load library '%s' for feature '%s'" % [lib, name]
return false