diff options
| author | Luke Kanies <luke@madstop.com> | 2008-08-07 18:40:06 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-08-07 18:40:06 -0700 |
| commit | 86a718856f4ca3c67450159645307b3c542db799 (patch) | |
| tree | d6a144bee7b2243e76fff5396077560eea372ce3 /lib | |
| parent | a31c578e73ed76903c6382016e46b9d6aef34457 (diff) | |
| download | puppet-86a718856f4ca3c67450159645307b3c542db799.tar.gz puppet-86a718856f4ca3c67450159645307b3c542db799.tar.xz puppet-86a718856f4ca3c67450159645307b3c542db799.zip | |
Fixing the SSL::Host#waitforcert method.
It now works the way puppetd needs it to, rather
than the way I thought it would need to work.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/ssl/host.rb | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index a449dcc7e..d3805eb20 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -187,18 +187,34 @@ class Puppet::SSL::Host # 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 + begin + generate + + return :new if certificate + rescue StandardError => detail + Puppet.err "Could not request certificate: %s" % detail.to_s + if time < 1 + puts "Exiting; failed to retrieve certificate and watiforcert is disabled" + exit(1) + else + sleep(time) + end + retry + end + + if time < 1 + puts "Exiting; no certificate found and waitforcert is disabled" + exit(1) + end 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 + sleep time + begin + break if certificate + Puppet.notice "Did not receive certificate" + rescue StandardError => detail + Puppet.err "Could not request certificate: %s" % detail.to_s + end end return :new end |
