237: def wait_for_cert(time)
238: begin
239: return if certificate
240: generate
241: return if certificate
242: rescue Exception => detail
243: Puppet.err "Could not request certificate: %s" % detail.to_s
244: if time < 1
245: puts "Exiting; failed to retrieve certificate and watiforcert is disabled"
246: exit(1)
247: else
248: sleep(time)
249: end
250: retry
251: end
252:
253: if time < 1
254: puts "Exiting; no certificate found and waitforcert is disabled"
255: exit(1)
256: end
257:
258: while true do
259: sleep time
260: begin
261: break if certificate
262: Puppet.notice "Did not receive certificate"
263: rescue StandardError => detail
264: Puppet.err "Could not request certificate: %s" % detail.to_s
265: end
266: end
267: end