Method: Kitchen::LifecycleHooks#run_with_hooks

Defined in:
lib/kitchen/lifecycle_hooks.rb

#run_with_hooks(phase, state_file, &block) ⇒ void

This method returns an undefined value.

Run a lifecycle phase with the pre and post hooks.

Parameters:

  • phase (String)

    Lifecycle phase which is being executed.

  • state_file (StateFile)

    Instance state file object.

  • block (Proc)

    Block of code implementing the lifecycle phase.

Since:

  • 1.22



45
46
47
48
49
50
51
# File 'lib/kitchen/lifecycle_hooks.rb', line 45

def run_with_hooks(phase, state_file, &block)
  run(phase, :pre)
  yield
  run(phase, :post)
ensure
  run(phase, :finally)
end