[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:56 UTC 2009


The following commit has been merged in the master branch:
commit 8616d74b47ac9177a3f29f1ebf63902bdefb3275
Author: Luke Kanies <luke at madstop.com>
Date:   Mon Dec 8 00:00:17 2008 -0600

    Fixing #1800 - tidy now correctly ignores missing files and directories
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index e37da5e..b4df4a9 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -44,7 +44,14 @@ module Puppet
             end
 
             def insync?(is)
-                if File.lstat(resource[:path]).ftype == "directory" and ! @resource[:rmdirs]
+                begin
+                    stat = File.lstat(resource[:path])
+                rescue Errno::ENOENT
+                    info "Tidy target does not exist; ignoring"
+                    return true
+                end
+
+                if stat.ftype == "directory" and ! @resource[:rmdirs]
                     self.debug "Not tidying directories"
                     return true
                 end
diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb
index ee820d4..9bcae86 100755
--- a/spec/unit/type/tidy.rb
+++ b/spec/unit/type/tidy.rb
@@ -6,6 +6,14 @@ tidy = Puppet::Type.type(:tidy)
 
 describe tidy do
     after { tidy.clear }
+    
+    it "should be in sync if the targeted file does not exist" do
+        File.expects(:lstat).with("/tmp/foonesslaters").raises Errno::ENOENT
+        @tidy = tidy.create :path => "/tmp/foonesslaters", :age => "100d"
+
+        @tidy.property(:ensure).must be_insync({})
+    end
+
     [:ensure, :age, :size].each do |property|
         it "should have a %s property" % property do
             tidy.attrclass(property).ancestors.should be_include(Puppet::Property)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list