class Puppet::SSL::StateMachine::NeedLock

Acquire the ssl lock or return LockFailure causing us to exit.

Public Class Methods

new(machine) click to toggle source
    # File lib/puppet/ssl/state_machine.rb
305 def initialize(machine)
306   super(machine, nil)
307 end

Public Instance Methods

next_state() click to toggle source
    # File lib/puppet/ssl/state_machine.rb
309 def next_state
310   if @machine.lock
311     # our ssl directory may have been cleaned while we were
312     # sleeping, start over from the top
313     NeedCACerts.new(@machine)
314   elsif @machine.waitforlock < 1
315     LockFailure.new(@machine, _("Another puppet instance is already running and the waitforlock setting is set to 0; exiting"))
316   elsif Time.now.to_i >= @machine.waitlock_deadline
317     LockFailure.new(@machine, _("Another puppet instance is already running and the maxwaitforlock timeout has been exceeded; exiting"))
318   else
319     Puppet.info _("Another puppet instance is already running; waiting for it to finish")
320     Puppet.info _("Will try again in %{time} seconds.") % {time: @machine.waitforlock}
321     Kernel.sleep @machine.waitforlock
322 
323     # try again
324     self
325   end
326 end