Class: Chef::Handler::Genesis

Inherits:
Chef::Handler show all
Defined in:
lib/chef/handler/genesis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Genesis

Returns a new instance of Genesis.



15
16
17
# File 'lib/chef/handler/genesis.rb', line 15

def initialize(config = {})
  @config = Mash.new(config)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



13
14
15
# File 'lib/chef/handler/genesis.rb', line 13

def config
  @config
end

Instance Method Details

#reportObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chef/handler/genesis.rb', line 19

def report
  if defined?(Bugsnag)
    @bugsnag_config = Bugsnag::Configuration.new
    @bugsnag_config.api_key = @config.delete('bugsnag_api_key')
    @bugsnag_config.app_version = GenesisCollector::VERSION
    @bugsnag_config.project_root = File.expand_path('../../..', File.dirname(__FILE__))
    @bugsnag_config.release_stage = run_context.node.chef_environment
    @config[:error_handler] = ->(e) { Bugsnag::Notification.new(e, @bugsnag_config).deliver }
  end
  prepare_report
  send_report
end