summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-07-09 09:55:19 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 10:00:26 -0700
commitc58e42090f3a1a151406f6a63652c697cb6e687d (patch)
tree6f684ebc71f4c41e14feb2448e717506cf693aec
parentb4593f24871b8e6525293f7dc6607bb5ba9ba6fe (diff)
downloadpuppet-c58e42090f3a1a151406f6a63652c697cb6e687d.tar.gz
puppet-c58e42090f3a1a151406f6a63652c697cb6e687d.tar.xz
puppet-c58e42090f3a1a151406f6a63652c697cb6e687d.zip
[#4180] Support legacy module structure
This patch updates the earlier #4180 patches to support both the old and the new module structures.
-rw-r--r--lib/puppet/indirector/facts/facter.rb4
-rwxr-xr-xspec/unit/indirector/facts/facter_spec.rb1
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb
index 75c6529ca..9d181706c 100644
--- a/lib/puppet/indirector/facts/facter.rb
+++ b/lib/puppet/indirector/facts/facter.rb
@@ -10,7 +10,9 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
def self.load_fact_plugins
# Add any per-module fact directories to the factpath
module_fact_dirs = Puppet[:modulepath].split(":").collect do |d|
- Dir.glob("%s/*/lib/facter" % d)
+ ["lib", "plugins"].map do |subdirectory|
+ Dir.glob("%s/*/#{subdirectory}/facter" % d)
+ end
end.flatten
dirs = module_fact_dirs + Puppet[:factpath].split(":")
x = dirs.each do |dir|
diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb
index a6dd8868d..8f39badb1 100755
--- a/spec/unit/indirector/facts/facter_spec.rb
+++ b/spec/unit/indirector/facts/facter_spec.rb
@@ -128,6 +128,7 @@ describe Puppet::Node::Facts::Facter do
Puppet.settings.expects(:value).with(:modulepath).returns("one%stwo" % File::PATH_SEPARATOR)
+ Dir.stubs(:glob).returns []
Dir.expects(:glob).with("one/*/lib/facter").returns %w{oneA oneB}
Dir.expects(:glob).with("two/*/lib/facter").returns %w{twoA twoB}