diff options
author | Luke Kanies <luke@madstop.com> | 2008-08-04 11:00:57 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-08-04 11:00:57 -0500 |
commit | c464bf21676c907642be3ad2c71b941318469325 (patch) | |
tree | 9db9f5ffed2254835b554bff3ffe70f0d0fcaa33 /lib | |
parent | c854dbe416939a930776405a5fa7ac87f84901d8 (diff) | |
download | puppet-c464bf21676c907642be3ad2c71b941318469325.tar.gz puppet-c464bf21676c907642be3ad2c71b941318469325.tar.xz puppet-c464bf21676c907642be3ad2c71b941318469325.zip |
Adding wait_for_cert functionality to the ssl host class.
This essentially deprecates the CertHandler module.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/ssl/host.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index 7fee81a24..6bbd93853 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -180,6 +180,25 @@ class Puppet::SSL::Host end return store end + + # Attempt to retrieve a cert, if we don't already have one. + def wait_for_cert(time) + return :existing if certificate + exit(1) if time < 1 + generate_certificate_request + + while true do + begin + break if certificate + Puppet.notice "Did not receive certificate" + rescue StandardError => detail + Puppet.err "Could not request certificate: %s" % detail.to_s + end + + sleep time + end + return :new + end end require 'puppet/ssl/certificate_authority' |