225: def wait_for_cert(time)
226: begin
227: return if certificate
228: generate
229: return if certificate
230: rescue SystemExit,NoMemoryError
231: raise
232: rescue Exception => detail
233: puts detail.backtrace if Puppet[:trace]
234: Puppet.err "Could not request certificate: #{detail}"
235: if time < 1
236: puts "Exiting; failed to retrieve certificate and waitforcert is disabled"
237: exit(1)
238: else
239: sleep(time)
240: end
241: retry
242: end
243:
244: if time < 1
245: puts "Exiting; no certificate found and waitforcert is disabled"
246: exit(1)
247: end
248:
249: while true
250: sleep time
251: begin
252: break if certificate
253: Puppet.notice "Did not receive certificate"
254: rescue StandardError => detail
255: puts detail.backtrace if Puppet[:trace]
256: Puppet.err "Could not request certificate: #{detail}"
257: end
258: end
259: end