[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.1rc1-141-gcdb2b90

markus (none) markus at AVA-351181.
Mon Aug 16 12:48:44 UTC 2010


The following commit has been merged in the upstream branch:
commit 00ebf01227745edc84084d10a9d8be7439551b0f
Author: Paul Berry <paul at puppetlabs.com>
Date:   Tue Jul 27 11:34:32 2010 -0700

    [#4344] Fix for failing templates when module name matches file in local dir.
    
    When the name of a module matches the name of a file in the local
    directory, puppet agent would sometimes try to read that file and
    interpret it as puppet code.  This happened because files.rb was
    unintentionally permitting puppet files without an extension.  Fixed
    by changing the glob pattern to only permit ".pp" and ".rb"
    extensions.

diff --git a/lib/puppet/parser/files.rb b/lib/puppet/parser/files.rb
index 9ef05e1..f346831 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}' : '' )).uniq.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 fcfbfa6..3eb0db0 100644
--- a/spec/unit/parser/files_spec.rb
+++ b/spec/unit/parser/files_spec.rb
@@ -154,7 +154,7 @@ describe Puppet::Parser::Files do
 
     it "should match against provided fully qualified patterns" do
       pattern = @basepath + "/fully/qualified/pattern/*"
-      Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{my file list})
+      Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns(%w{my file list})
       Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{my file list}
     end
 
@@ -168,7 +168,7 @@ describe Puppet::Parser::Files do
       pattern = @basepath + "/fully/qualified/pattern/*"
       file = @basepath + "/my/file"
       dir = @basepath + "/my/directory"
-      Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns([file, dir])
+      Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns([file, dir])
       FileTest.expects(:directory?).with(file).returns(false)
       FileTest.expects(:directory?).with(dir).returns(true)
       Puppet::Parser::Files.find_manifests(pattern)[1].should == [file]
@@ -176,7 +176,7 @@ describe Puppet::Parser::Files do
 
     it "should return files once only" do
       pattern = @basepath + "/fully/qualified/pattern/*"
-      Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{one two one})
+      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
diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb
index 8f005d5..83006b3 100644
--- a/spec/unit/parser/type_loader_spec.rb
+++ b/spec/unit/parser/type_loader_spec.rb
@@ -192,7 +192,7 @@ describe Puppet::Parser::TypeLoader do
   end
 
   it "should be able to add classes to the current resource type collection" do
-    file = tmpfile("simple_file")
+    file = tmpfile("simple_file.pp")
     File.open(file, "w") { |f| f.puts "class foo {}" }
     @loader.import(file)
 
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 5a433c7..8cda8ee 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -97,7 +97,7 @@ class TestParser < Test::Unit::TestCase
     }
 
     4.times { |i|
-      path = File.join(basedir, subdir, "subfile#{i}")
+      path = File.join(basedir, subdir, "subfile#{i}.pp")
       mkmanifest(path)
     }
 
@@ -137,8 +137,8 @@ class TestParser < Test::Unit::TestCase
   end
 
   def test_importedclasses
-    imported = tempfile
-    importer = tempfile
+    imported = tempfile '.pp'
+    importer = tempfile '.pp'
 
     made = tempfile
 
@@ -655,9 +655,9 @@ file { "/tmp/yayness":
   end
 
   def test_multiple_imports_on_one_line
-    one = tempfile
-    two = tempfile
-    base = tempfile
+    one = tempfile '.pp'
+    two = tempfile '.pp'
+    base = tempfile '.pp'
     File.open(one, "w") { |f| f.puts "$var = value" }
     File.open(two, "w") { |f| f.puts "$var = value" }
     File.open(base, "w") { |f| f.puts "import '#{one}', '#{two}'" }
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index e31a319..294d0ef 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -227,14 +227,14 @@ module PuppetTest
     #Facter.stubs(:to_hash).returns({})
   end
 
-  def tempfile
+  def tempfile(suffix = '')
     if defined?(@@tmpfilenum)
       @@tmpfilenum += 1
     else
       @@tmpfilenum = 1
     end
 
-    f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s)
+    f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s + suffix)
     @@tmpfiles ||= []
     @@tmpfiles << f
     f

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list