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
295 def initialize(machine)
296   super(machine, nil)
297 end

Public Instance Methods

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