Method: Kitchen::Instance::FSM.actions

Defined in:
lib/kitchen/instance.rb

.actions(last = nil, desired) ⇒ Array<Symbol>

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 an Array of all transitions to bring an Instance from its last reported transistioned state into the desired transitioned state.

Parameters:

  • last (String, Symbol, nil) (defaults to: nil)

    the last known transitioned state of the Instance, defaulting to ‘nil` (for unknown or no history)

  • desired (String, Symbol)

    the desired transitioned state for the Instance

Returns:

  • (Array<Symbol>)

    an Array of transition actions to perform



699
700
701
702
703
704
705
706
707
708
# File 'lib/kitchen/instance.rb', line 699

def self.actions(last = nil, desired)
  last_index = index(last)
  desired_index = index(desired)

  if last_index == desired_index || last_index > desired_index
    Array(TRANSITIONS[desired_index])
  else
    TRANSITIONS.slice(last_index + 1, desired_index - last_index)
  end
end