summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2010-02-09 00:18:13 +1100
committerJames Turnbull <james@lovedthanlost.net>2010-02-09 04:39:10 +1100
commit71653a74d91b1e6e9845b4a41249861319c0d6b0 (patch)
treed47870a2e9c151ad34e314984d9a0f2fc1bdb750
parentefd0f76c3b40fb15528b3226687eb1ab454b0c42 (diff)
downloadpuppet-71653a74d91b1e6e9845b4a41249861319c0d6b0.tar.gz
puppet-71653a74d91b1e6e9845b4a41249861319c0d6b0.tar.xz
puppet-71653a74d91b1e6e9845b4a41249861319c0d6b0.zip
Fixed #3162 - tidy does not remove empty files when "size => 0" is set
Thanks to Stig Sandbeck Mathisen for the fix See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513309
-rwxr-xr-xlib/puppet/type/tidy.rb2
-rwxr-xr-xspec/unit/type/tidy.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index b5ccb3fb1..3d7190c27 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -139,7 +139,7 @@ Puppet::Type.newtype(:tidy) do
end
def tidy?(path, stat)
- if stat.size > value
+ if stat.size >= value
return true
else
return false
diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb
index 88e2e280a..ccec9ed7c 100755
--- a/spec/unit/type/tidy.rb
+++ b/spec/unit/type/tidy.rb
@@ -273,6 +273,12 @@ describe tidy do
@sizer.must be_tidy("/what/ever", @stat)
end
+
+ it "should return true if the file is equal to the specified size" do
+ @stat.expects(:size).returns(1024)
+
+ @sizer.must be_tidy("/what/ever", @stat)
+ end
end
describe "and determining whether a file should be tidied" do