diff options
| author | Luke Kanies <luke@madstop.com> | 2009-06-16 10:26:38 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-06-16 10:26:38 -0500 |
| commit | 4036de9591bc1ab19df3a0c3bae4567240a4ec85 (patch) | |
| tree | 9b9a9c58242851a184f85cbcf159950dbb5fc732 | |
| parent | ed876e0264bbb1ba86bc302d517d8f48f388da3e (diff) | |
| download | puppet-4036de9591bc1ab19df3a0c3bae4567240a4ec85.tar.gz puppet-4036de9591bc1ab19df3a0c3bae4567240a4ec85.tar.xz puppet-4036de9591bc1ab19df3a0c3bae4567240a4ec85.zip | |
Fixing #2094 - filebucket failures are clearer now
We just add a bit of information to the exception.
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | lib/puppet/network/client/dipper.rb | 7 | ||||
| -rwxr-xr-x | spec/unit/network/client/dipper.rb | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/puppet/network/client/dipper.rb b/lib/puppet/network/client/dipper.rb index 8616d4f73..0e2dc1425 100644 --- a/lib/puppet/network/client/dipper.rb +++ b/lib/puppet/network/client/dipper.rb @@ -25,7 +25,12 @@ class Puppet::Network::Client::Dipper < Puppet::Network::Client unless local? contents = Base64.encode64(contents) end - return @driver.addfile(contents,file) + begin + return @driver.addfile(contents,file) + rescue => detail + puts detail.backtrace if Puppet[:trace] + raise Puppet::Error, "Could not back up %s: %s" % [file, detail] + end end # Retrieve a file by sum. diff --git a/spec/unit/network/client/dipper.rb b/spec/unit/network/client/dipper.rb new file mode 100755 index 000000000..d1631fbb5 --- /dev/null +++ b/spec/unit/network/client/dipper.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe Puppet::Network::Client.dipper do + it "should fail in an informative way when there are failures backing up to the server" do + FileTest.stubs(:exists?).returns true + File.stubs(:read).returns "content" + + @dipper = Puppet::Network::Client::Dipper.new(:Path => "/my/bucket") + + @dipper.driver.expects(:addfile).raises ArgumentError + + lambda { @dipper.backup("/my/file") }.should raise_error(Puppet::Error) + end +end |
