From bb3b3cedf4082dc884e41b864fa755057d20e228 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 3 Oct 2007 19:36:35 -0500 Subject: I finally tracked down the problem that was causing providers to sometimes suddenly disappear and thus tests to fail -- Kernel.require was not loading the normal ruby path (e.g., 'puppet/type/cron'), so if someone else loaded that then it would replace the in-memory type with a new one, but that new one couldn't load its own providers, because the Kernel would ignore the providers, thinking they were already loaded. This doesn't fix all of the autoloading problems, but at least we won't suddenly break a ton of tests. --- lib/puppet/util/autoload.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 280961837..a52575522 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -107,16 +107,11 @@ class Puppet::Util::Autoload # Load every instance of everything we can find. eachdir do |dir| Dir.glob("#{dir}/*.rb").each do |file| - # Load here, rather than require, so that facts - # can be reloaded. This has some short-comings, I - # believe, but it works as long as real classes - # aren't used. name = File.basename(file).sub(".rb", '').intern next if loaded?(name) - next if $".include?(File.join(@path, name.to_s + ".rb")) - filepath = File.join(@path, name.to_s + ".rb") + rubypath = File.join(@path, name.to_s) begin - Kernel.require file + Kernel.require rubypath loaded(name, file) rescue => detail if Puppet[:trace] -- cgit