summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-08-31 16:01:17 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-09-01 21:04:06 +1000
commitd397f8d1d1092067f7ca52449ce9af63f02f44e1 (patch)
treef7ec36c5e05bd55b8e21fce565f493a85e2f65a0 /lib
parent800a78b993f15e2d77312bf207929ec876e9b227 (diff)
downloadpuppet-d397f8d1d1092067f7ca52449ce9af63f02f44e1.tar.gz
puppet-d397f8d1d1092067f7ca52449ce9af63f02f44e1.tar.xz
puppet-d397f8d1d1092067f7ca52449ce9af63f02f44e1.zip
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 <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util/autoload.rb9
1 files changed, 5 insertions, 4 deletions
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