diff options
Diffstat (limited to 'lib/puppet/ssl/host.rb')
-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' |