[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08

James Turnbull james at lovedthanlost.net
Fri Jan 15 09:07:15 UTC 2010


The following commit has been merged in the upstream branch:
commit 55d8ffaaa3052dd0e8e2915d974d99827a92d61e
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Sat Nov 14 16:21:05 2009 +0100

    Fix #2810 - adapt tidy to new FileSet api
    
    In #1469 we changed the FileSet internal api and missed that tidy
    was still using the old version.
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index f45171d..b5ccb3f 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -247,8 +247,15 @@ Puppet::Type.newtype(:tidy) do
     def generate
         return [] unless stat(self[:path])
 
-        if self[:recurse]
-            files = Puppet::FileServing::Fileset.new(self[:path], :recurse => self[:recurse]).files.collect do |f|
+        case self[:recurse]
+        when Integer, Fixnum, Bignum, /^\d+$/
+            parameter = { :recurse => true, :recurselimit => self[:recurse] }
+        when true, :true, :inf
+            parameter = { :recurse => true }
+        end
+
+        if parameter
+            files = Puppet::FileServing::Fileset.new(self[:path], parameter).files.collect do |f|
                 f == "." ? self[:path] : File.join(self[:path], f)
             end
         else
diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb
index caf5b22..88e2e28 100755
--- a/spec/unit/type/tidy.rb
+++ b/spec/unit/type/tidy.rb
@@ -7,6 +7,10 @@ tidy = Puppet::Type.type(:tidy)
 describe tidy do
     before do
         Puppet.settings.stubs(:use)
+
+        # for an unknown reason some of these specs fails when run individually
+        # with a failed expectation on File.lstat in the autoloader.
+        File.stubs(:lstat)
     end
 
     it "should use :lstat when stating a file" do
@@ -161,7 +165,7 @@ describe tidy do
                 Puppet::FileServing::Fileset.stubs(:new).returns @fileset
             end
 
-            it "should use a Fileset for recursion" do
+            it "should use a Fileset for infinite recursion" do
                 Puppet::FileServing::Fileset.expects(:new).with("/what/ever", :recurse => true).returns @fileset
                 @fileset.expects(:files).returns %w{. one two}
                 @tidy.stubs(:tidy?).returns false
@@ -169,6 +173,15 @@ describe tidy do
                 @tidy.generate
             end
 
+            it "should use a Fileset for limited recursion" do
+                @tidy[:recurse] = 42
+                Puppet::FileServing::Fileset.expects(:new).with("/what/ever", :recurse => true, :recurselimit => 42).returns @fileset
+                @fileset.expects(:files).returns %w{. one two}
+                @tidy.stubs(:tidy?).returns false
+
+                @tidy.generate
+            end
+
             it "should generate a file resource for every file that should be tidied but not for files that should not be tidied" do
                 @fileset.expects(:files).returns %w{. one two}
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list