summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-13 17:29:23 -0600
committerLuke Kanies <luke@madstop.com>2008-02-13 17:29:23 -0600
commit892055709a7e0b628758d24aba7590fd3c78426b (patch)
tree5db38e211c9eba3e1acc95856b2f97f82388cc30
parent482971103b436e030606371df69bf4dfbbf54a2c (diff)
downloadpuppet-892055709a7e0b628758d24aba7590fd3c78426b.tar.gz
puppet-892055709a7e0b628758d24aba7590fd3c78426b.tar.xz
puppet-892055709a7e0b628758d24aba7590fd3c78426b.zip
Fixing #1064 -- providers et al are now autoloaded
from modules even when Autoload#loadall is used.
-rw-r--r--lib/puppet/util/autoload.rb3
-rwxr-xr-xtest/util/autoload.rb10
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb
index 5f13d936b..535d9ef2e 100644
--- a/lib/puppet/util/autoload.rb
+++ b/lib/puppet/util/autoload.rb
@@ -112,9 +112,8 @@ class Puppet::Util::Autoload
Dir.glob("#{dir}/*.rb").each do |file|
name = File.basename(file).sub(".rb", '').intern
next if loaded?(name)
- rubypath = File.join(@path, name.to_s)
begin
- Kernel.require rubypath
+ Kernel.require file
loaded(name, file)
rescue => detail
if Puppet[:trace]
diff --git a/test/util/autoload.rb b/test/util/autoload.rb
index 3fe18352c..05363d13e 100755
--- a/test/util/autoload.rb
+++ b/test/util/autoload.rb
@@ -103,10 +103,10 @@ TestAutoload.newthing(:#{name.to_s})
assert(loader.send(:searchpath).include?(dir), "searchpath does not include the libdir")
end
- # This causes very strange behaviour in the tests. We need to make sure we
- # require the same path that a user would use, otherwise we'll result in
- # a reload of the
- def test_require_does_not_cause_reload
+ # This tests #1064, which was caused by using the unqualified
+ # path for requires, which was initially done so that the kernel
+ # would keep track of which files got loaded.
+ def test_require_uses_full_path
loadname = "testing"
loader = Puppet::Util::Autoload.new(self.class, loadname)
@@ -120,7 +120,7 @@ TestAutoload.newthing(:#{name.to_s})
Dir.expects(:glob).with("#{dir}/*.rb").returns(file)
- Kernel.expects(:require).with(File.join(loadname, subname))
+ Kernel.expects(:require).with(file)
loader.loadall
end