summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/files.rb2
-rw-r--r--spec/unit/parser/files_spec.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/parser/files.rb b/lib/puppet/parser/files.rb
index 749743493..9ef05e102 100644
--- a/lib/puppet/parser/files.rb
+++ b/lib/puppet/parser/files.rb
@@ -24,7 +24,7 @@ module Puppet::Parser::Files
# Than that would be a "no."
end
abspat = File::expand_path(start, cwd)
- [nil, Dir.glob(abspat + (File.extname(abspat).empty? ? '{,.pp,.rb}' : '' )).reject { |f| FileTest.directory?(f) }]
+ [nil, Dir.glob(abspat + (File.extname(abspat).empty? ? '{,.pp,.rb}' : '' )).uniq.reject { |f| FileTest.directory?(f) }]
end
# Find the concrete file denoted by +file+. If +file+ is absolute,
diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb
index d1b5491a2..fcfbfa613 100644
--- a/spec/unit/parser/files_spec.rb
+++ b/spec/unit/parser/files_spec.rb
@@ -173,6 +173,12 @@ describe Puppet::Parser::Files do
FileTest.expects(:directory?).with(dir).returns(true)
Puppet::Parser::Files.find_manifests(pattern)[1].should == [file]
end
+
+ it "should return files once only" do
+ pattern = @basepath + "/fully/qualified/pattern/*"
+ Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{one two one})
+ Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{one two}
+ end
end
describe "when searching for manifests in a found module" do