summaryrefslogtreecommitdiffstats
path: root/lib/puppet/ssl
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-01-23 16:10:58 -0600
committerLuke Kanies <luke@madstop.com>2009-02-06 18:08:41 -0600
commitb672790ff04022c043c9dc10d47ac82787ce5632 (patch)
tree7e01363797184cac401f0edb388a694a9c725a3e /lib/puppet/ssl
parentf78a5653ae1c0fe3931c4102ce32f640c80db158 (diff)
downloadpuppet-b672790ff04022c043c9dc10d47ac82787ce5632.tar.gz
puppet-b672790ff04022c043c9dc10d47ac82787ce5632.tar.xz
puppet-b672790ff04022c043c9dc10d47ac82787ce5632.zip
Cleaning up SSL instances that can't be saved
If the SSL Host couldn't save a CSR or key, it would still keep them in memory; this meant that, for instance, a CSR that couldn't be saved to the server was never resent. This commit removes in-memory instances that couldn't be saved, thus forcing regeneration. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/ssl')
-rw-r--r--lib/puppet/ssl/host.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb
index e8a98e9b8..ccb405f64 100644
--- a/lib/puppet/ssl/host.rb
+++ b/lib/puppet/ssl/host.rb
@@ -128,7 +128,12 @@ class Puppet::SSL::Host
def generate_key
@key = Key.new(name)
@key.generate
- @key.save
+ begin
+ @key.save
+ rescue
+ @key = nil
+ raise
+ end
true
end
@@ -142,7 +147,13 @@ class Puppet::SSL::Host
generate_key unless key
@certificate_request = CertificateRequest.new(name)
@certificate_request.generate(key.content)
- @certificate_request.save
+ begin
+ @certificate_request.save
+ rescue
+ @certificate_request = nil
+ raise
+ end
+
return true
end