Signed-off-by: Luke Kanies <[EMAIL PROTECTED]>
---
 CHANGELOG               |    2 ++
 lib/puppet/type/file.rb |    9 +++++++++
 spec/unit/type/file.rb  |    6 ++++++
 3 files changed, 17 insertions(+), 0 deletions(-)

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
-- 
1.5.3.7


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to