From 2a73b5d194a5237722840844588a03addedf2d4c Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Sat, 22 May 2010 17:58:44 -0700 Subject: [#3674] Part 2: Autoloader load method should propagate failures Change Autoloader's load to re-raise exceptions that happen when trying to load files, rather than just warning. This version still does not raise an error if the file is not found, as doing so would change the behavior of 'load' pretty significantly, but I am ambivalent this. --- lib/puppet/util/autoload.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 006554d5a..a1c44cdd6 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -74,8 +74,6 @@ class Puppet::Util::Autoload # Load a single plugin by name. We use 'load' here so we can reload a # given plugin. def load(name,env=nil) - return false if named_file_missing?(name) - path = name.to_s + ".rb" searchpath(env).each do |dir| @@ -90,11 +88,10 @@ class Puppet::Util::Autoload raise rescue Exception => detail puts detail.backtrace if Puppet[:trace] - warn "Could not autoload #{name}: #{detail}" - return named_file_is_missing(name) + raise Puppet::Error, "Could not autoload #{name}: #{detail}" end end - return named_file_is_missing(name) + false end # Mark the named object as loaded. Note that this supports unqualified -- cgit