diff options
| author | Luke Kanies <luke@madstop.com> | 2008-09-16 11:41:48 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-09-16 11:41:48 -0500 |
| commit | a1a670b305252b2f4b4b2b0020303143addc3eb8 (patch) | |
| tree | f64c80cc62941670dd2a4c12d88a99e5e24dd49d | |
| parent | dd4f65478c23eaeb56dcef588f96bfdd31557080 (diff) | |
| download | puppet-a1a670b305252b2f4b4b2b0020303143addc3eb8.tar.gz puppet-a1a670b305252b2f4b4b2b0020303143addc3eb8.tar.xz puppet-a1a670b305252b2f4b4b2b0020303143addc3eb8.zip | |
Fixed #1572 -- file purging now fails if remote sources do not exist.
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | CHANGELOG | 2 | ||||
| -rw-r--r-- | lib/puppet/type/file.rb | 9 | ||||
| -rwxr-xr-x | spec/unit/type/file.rb | 6 |
3 files changed, 17 insertions, 0 deletions
@@ -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 3518e8bb3..875f8c370 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 3ea4c3731..fd790d678 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 |
