SimpleFinance / chef-handler-sensu-event

Send an arbitrary event to your Sensu server upon Chef failure
Apache License 2.0
8 stars 3 forks source link

tried both examples with chef 12.3.0 #7

Open acqant opened 9 years ago

acqant commented 9 years ago
 * chef_handler[SensuEvent] action enable
    - disable SensuEvent as a report handler
    - disable SensuEvent as a exception handler
    ================================================================================
    Error executing action `enable` on resource 'chef_handler[SensuEvent]'
    ================================================================================

    NameError
    ---------
    uninitialized constant Kernel::SensuEvent

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/chef_handler/libraries/helpers.rb:53:in `const_get'
    /var/chef/cache/cookbooks/chef_handler/libraries/helpers.rb:53:in `get_class'
    /var/chef/cache/cookbooks/chef_handler/providers/default.rb:42:in `block (2 levels) in class_from_file'
    /var/chef/cache/cookbooks/chef_handler/providers/default.rb:40:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/cb-base/recipes/_prereqs.rb

      9:    chef_handler 'SensuEvent' do
     10:      source "#{node[:chef_handler][:handler_path]}/chef-handler-sensu-event.rb"
     11:      action :enable
     12:    end
     13: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/cb-base/recipes/_prereqs.rb:9:in `from_file'

    chef_handler("SensuEvent") do
      action [:enable]
      supports {:report=>true, :exception=>true}
      retries 0
   - install version 0.2.0 of package chef-handler-sensu-event

  ================================================================================
  Recipe Compile Error in /var/chef/cache/cookbooks/cb-base/recipes/default.rb
  ================================================================================

  NoMethodError
  -------------
  undefined method `all_load_paths' for Gem:Module

  Cookbook Trace:
  ---------------
    /var/chef/cache/cookbooks/cb-base/recipes/_prereqs.rb:9:in `block in from_file'
    /var/chef/cache/cookbooks/cb-base/recipes/_prereqs.rb:8:in `from_file'
    /var/chef/cache/cookbooks/cb-base/recipes/default.rb:13:in `from_file'

  Relevant File Content:
  ----------------------
  /var/chef/cache/cookbooks/cb-base/recipes/_prereqs.rb:

    2:
    3:  unless node['kitchen'] == true
    4:    chef_gem 'chef-handler-sensu-event' do
    5:      action :install
    6:    end
    7:
    8:    chef_handler 'Chef::Handler::SensuEvent' do
    9>>     source ::File.join(Gem.all_load_paths.grep(/chef-handler-sensu-event/).first,
   10:                         'chef-handler-sensu-event.rb')
   11:      action :enable
   12:    end
   13:  end
   14:
acqant commented 9 years ago

This fixed it

chef_handler 'Chef::Handler::SensuEvent' do
 source "#{node[:chef_handler][:handler_path]}/chef-handler-sensu-event.rb"
     action :enable
   end
jakedavis commented 9 years ago

Makes sense. Sorry about this. We're still on Chef 11 and no longer using this gem :/ would review a PR updating it as such though.

jhmartin commented 7 years ago

@jakedavis what are you using instead?

jakedavis commented 7 years ago

We have an internally-developed service for broadcasting messages, to Slack in particular; the Chef run reports to that service instead of going through Sensu.