From 5afa587dfe152e29dba480305be8042fa9fb3f0a Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 20 Apr 2007 16:40:47 +0000 Subject: Fixing #588 - the parser correctly ignores directories in globbing now git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2404 980ebf18-57e1-0310-9a29-db15c13687c0 --- CHANGELOG | 3 +++ lib/puppet/modules.rb | 4 ++-- test/language/parser.rb | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 51bf853d3..000b4ba95 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ + Modules no longer return directories in the list of found + manifests (#588). + The crontab provider now defaults to root when there is no USER set in the environment. diff --git a/lib/puppet/modules.rb b/lib/puppet/modules.rb index 5e7868cb5..aa2f75d03 100644 --- a/lib/puppet/modules.rb +++ b/lib/puppet/modules.rb @@ -70,9 +70,9 @@ class Puppet::Module return mod.manifests(pat) else abspat = File::expand_path(pat, cwd) - files = Dir.glob(abspat) + files = Dir.glob(abspat).reject { |f| FileTest.directory?(f) } if files.size == 0 - files = Dir.glob(abspat + ".pp") + files = Dir.glob(abspat + ".pp").reject { |f| FileTest.directory?(f) } end return files end diff --git a/test/language/parser.rb b/test/language/parser.rb index b01720e08..14e27d86b 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -747,6 +747,22 @@ file { "/tmp/yayness": parser.parse("$one::two = yay") end end + + # #588 + def test_globbing_with_directories + dir = tempfile + Dir.mkdir(dir) + subdir = File.join(dir, "subdir") + Dir.mkdir(subdir) + file = File.join(dir, "file.pp") + maker = tempfile + File.open(file, "w") { |f| f.puts "file { '#{maker}': ensure => file }" } + + parser = mkparser + assert_nothing_raised("Globbing failed when it matched a directory") do + parser.import("%s/*" % dir) + end + end end # $Id$ -- cgit