From d397f8d1d1092067f7ca52449ce9af63f02f44e1 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 31 Aug 2009 16:01:17 -0700 Subject: Fixing #2574 - autoloading finds plugins in modules We had some stupid errors that were preventing this from happening; this fixes them and adds an integration test. Signed-off-by: Luke Kanies --- lib/puppet/util/autoload.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index b48e3afa1..ec2f48c7b 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -142,10 +142,11 @@ class Puppet::Util::Autoload end def module_directories - Puppet.settings.value(:modulepath, Puppet[:environment]).find_all do |dir| - FileTest.directory?(dir) - end.collect do |dir| - Dir.entries(dir) + # We have to require this late in the process because otherwise we might have + # load order issues. + require 'puppet/node/environment' + Puppet::Node::Environment.new.modulepath.collect do |dir| + Dir.entries(dir).reject { |f| f =~ /^\./ }.collect { |f| File.join(dir, f) } end.flatten.collect { |d| [File.join(d, "plugins"), File.join(d, "lib")] }.flatten.find_all do |d| FileTest.directory?(d) end -- cgit