summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSean Millichamp <sean@bruenor.org>2010-05-07 08:58:50 -0400
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitb10d35d0da8f630e004966a52ac3ecd01287d36c (patch)
tree5fc53460d951fda9d11ad8a59a9e6faffe4a466f /lib
parent584961a82ffbe64c04cb4a7c152f90164274ddb2 (diff)
downloadpuppet-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 'lib')
-rw-r--r--lib/puppet/provider/ssh_authorized_key/parsed.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index fb4d0956e..b222e5133 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -54,7 +54,11 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed,
end
def target
- @resource.should(:target) || File.expand_path("~%s/.ssh/authorized_keys" % user)
+ begin
+ @resource.should(:target) || File.expand_path("~%s/.ssh/authorized_keys" % user)
+ rescue
+ raise Puppet::Error, "Target not defined and/or specified user does not exist yet"
+ end
end
def user