From c58e42090f3a1a151406f6a63652c697cb6e687d Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 9 Jul 2010 09:55:19 -0700 Subject: [#4180] Support legacy module structure This patch updates the earlier #4180 patches to support both the old and the new module structures. --- lib/puppet/indirector/facts/facter.rb | 4 +++- spec/unit/indirector/facts/facter_spec.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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} -- cgit