Class: CampfireHandler

Inherits:
Chef::Handler
  • Object
show all
Defined in:
lib/campfire_handler.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ CampfireHandler

Returns a new instance of CampfireHandler.



7
8
9
# File 'lib/campfire_handler.rb', line 7

def initialize(opts = {})
  @config = opts
end

Instance Method Details

#reportObject



11
12
13
14
15
16
17
18
# File 'lib/campfire_handler.rb', line 11

def report()
    if run_status.failed?
      Chef::Log.error("Creating Campfire exception report")
      campfire = Tinder::Campfire.new(@config[:subdomain], :token => @config[:token])
      campfire.rooms.first.speak("#{node.hostname} #{run_status.formatted_exception}")
      campfire.rooms.first.paste(Array(backtrace).join("\n"))
  end
end