class Puppet::SSL::StateMachine::Wait

We cannot make progress, so wait if allowed to do so, or exit.

Public Class Methods

new(machine) click to toggle source
    # File lib/puppet/ssl/state_machine.rb
276 def initialize(machine)
277   super(machine, nil)
278 end

Public Instance Methods

next_state() click to toggle source
    # File lib/puppet/ssl/state_machine.rb
280 def next_state
281   time = @machine.waitforcert
282   if time < 1
283     log_error(_("Exiting now because the waitforcert setting is set to 0."))
284     exit(1)
285   elsif Time.now.to_i > @machine.wait_deadline
286     log_error(_("Couldn't fetch certificate from CA server; you might still need to sign this agent's certificate (%{name}). Exiting now because the maxwaitforcert timeout has been exceeded.") % {name: Puppet[:certname] })
287     exit(1)
288   else
289     Puppet.info(_("Will try again in %{time} seconds.") % {time: time})
290 
291     # close http/tls and session state before sleeping
292     Puppet.runtime[:http].close
293     @machine.session = Puppet.runtime[:http].create_session
294 
295     @machine.unlock
296     Kernel.sleep(time)
297     NeedLock.new(@machine)
298   end
299 end