Method: ChefApply::Action::Base#run

Defined in:
lib/chef_apply/action/base.rb

#run(&block) ⇒ Object

Raises:

  • (@error)


112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/chef_apply/action/base.rb', line 112

def run(&block)
  @notification_handler = block
  Telemeter.timed_action_capture(self) do
    begin
      perform_action
    rescue StandardError => e
      # Give the caller a chance to clean up - if an exception is
      # raised it'll otherwise get routed through the executing thread,
      # providing no means of feedback for the caller's current task.
      notify(:error, e)
      @error = e
    end
  end
  # Raise outside the block to ensure that the telemetry cpature completes
  raise @error unless @error.nil?
end