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

Luke Kanies luke at madstop.com
Fri Jan 23 14:20:56 UTC 2009


The following commit has been merged in the master branch:
commit a1a670b305252b2f4b4b2b0020303143addc3eb8
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Sep 16 11:41:48 2008 -0500

    Fixed #1572 -- file purging now fails if remote sources do not exist.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/CHANGELOG b/CHANGELOG
index 441e68e..303b115 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.x
+    Fixed #1572 -- file purging now fails if remote sources do not exist.
+
     Fixed issues with file descriptors leaking into subprocesses
 
     Fixed #1568 - createpackage.sh
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 3518e8b..875f8c3 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -849,6 +849,8 @@ module Puppet
             # Keep track of all the files we found in the source, so we can purge
             # appropriately.
             sourced = []
+
+            success = false
             
             @parameters[:source].should.each do |source|
                 sourceobj, path = uri2obj(source)
@@ -863,6 +865,8 @@ module Puppet
                 if desc == "" 
                     next
                 end
+
+                success = true
             
                 # Now create a new child for every file returned in the list.
                 result += desc.split("\n").collect { |line|
@@ -898,6 +902,11 @@ module Puppet
                     return [result, sourced]
                 end
             end
+
+            unless success
+                raise Puppet::Error, "None of the provided sources exist"
+            end
+
             return [result, sourced]
         end
 
diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index 3ea4c37..fd790d6 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -69,6 +69,12 @@ describe Puppet::Type.type(:file) do
             @filesource.server.stubs(:describe).raises(Puppet::Network::XMLRPCClientError.new("Testing"))
             lambda { @file.retrieve }.should raise_error(Puppet::Error)
         end
+
+        it "should fail during eval_generate if no remote sources exist" do
+            file = Puppet::Type.type(:file).create :path => "/foobar", :source => "/this/file/does/not/exist", :recurse => true
+
+            lambda { file.eval_generate }.should raise_error(Puppet::Error)
+        end
     end
 
     describe "when managing links" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list