Class: Puppet::SSL::StateMachine::NeedLock Private
- Defined in:
- lib/puppet/ssl/state_machine.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Acquire the ssl lock or return LockFailure causing us to exit.
Instance Attribute Summary
Attributes inherited from SSLState
Instance Method Summary collapse
-
#initialize(machine) ⇒ NeedLock
constructor
private
A new instance of NeedLock.
- #next_state ⇒ Object private
Methods inherited from SSLState
Constructor Details
#initialize(machine) ⇒ NeedLock
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NeedLock.
304 305 306 |
# File 'lib/puppet/ssl/state_machine.rb', line 304 def initialize(machine) super(machine, nil) end |
Instance Method Details
#next_state ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/puppet/ssl/state_machine.rb', line 308 def next_state if @machine.lock # our ssl directory may have been cleaned while we were # sleeping, start over from the top NeedCACerts.new(@machine) elsif @machine.waitforlock < 1 LockFailure.new(@machine, _("Another puppet instance is already running and the waitforlock setting is set to 0; exiting")) elsif Time.now.to_i >= @machine.waitlock_deadline LockFailure.new(@machine, _("Another puppet instance is already running and the maxwaitforlock timeout has been exceeded; exiting")) else Puppet.info _("Another puppet instance is already running; waiting for it to finish") Puppet.info _("Will try again in %{time} seconds.") % {time: @machine.waitforlock} Kernel.sleep @machine.waitforlock # try again self end end |