diff options
author | Sean Millichamp <sean@bruenor.org> | 2010-05-07 08:58:50 -0400 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | b10d35d0da8f630e004966a52ac3ecd01287d36c (patch) | |
tree | 5fc53460d951fda9d11ad8a59a9e6faffe4a466f /spec/unit/provider | |
parent | 584961a82ffbe64c04cb4a7c152f90164274ddb2 (diff) | |
download | puppet-b10d35d0da8f630e004966a52ac3ecd01287d36c.tar.gz puppet-b10d35d0da8f630e004966a52ac3ecd01287d36c.tar.xz puppet-b10d35d0da8f630e004966a52ac3ecd01287d36c.zip |
Fixes #3745 Catch unhandled exception in ssh_authorized_key provider
If the target is not specified it is automatically set to the user's
home directory. If the user does not exist when the generation of
the target path occurs then an ArgumentError exception is raised
but not caught. This patch catches the ArgumentError and raises
a Puppet::Error instead to more gracefully notify the user and allow
any remaining resources to be applied.
Signed-off-by: Sean Millichamp <sean@bruenor.org>
Diffstat (limited to 'spec/unit/provider')
-rwxr-xr-x | spec/unit/provider/ssh_authorized_key/parsed.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/provider/ssh_authorized_key/parsed.rb b/spec/unit/provider/ssh_authorized_key/parsed.rb index 0edf2b0ae..f8613e35e 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed.rb @@ -204,5 +204,17 @@ describe provider_class do proc { @provider.flush }.should raise_error end end + + describe "and a invalid user has been specified with no target" do + before :each do + @resource.stubs(:should).with(:user).returns "thisusershouldnotexist" + @resource.stubs(:should).with(:target).returns nil + end + + it "should catch an exception and raise a Puppet error" do + lambda { @provider.flush }.should raise_error(Puppet::Error) + end + end + end end |