Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 400 Bytes

dsl_handler_slide_send_email_handler.md

File metadata and controls

17 lines (14 loc) · 400 Bytes

Invoke the library helper in a recipe:

Chef.event_handler do
  on :run_failed do
    HandlerSendEmail::Helper.new.send_email_on_run_failure(
      Chef.run_context.node.name
    )
  end
end
  • Use Chef.event_handler to define the event handler
  • Use the on method to specify the event type

Within the on block, tell Chef Infra Client how to handle the event when it is triggered.