Skip to content

Instantly share code, notes, and snippets.

@sawanoboly
Last active December 29, 2015 23:58
Show Gist options
  • Save sawanoboly/7745867 to your computer and use it in GitHub Desktop.
Save sawanoboly/7745867 to your computer and use it in GitHub Desktop.
Sample: Chef::EventDispatch::Irchandler
class Chef::EventDispatch::Irchandler
require 'carrier-pigeon'
def initialize
@ohai = Ohai::System.new
@ohai._require_plugin('os')
@ohai._require_plugin('hostname')
end
def method_missing(*args)
line = [@ohai.fqdn, args].flatten.join(':')
puts line
CarrierPigeon.send(
:uri => "irc://#{@ohai.hostname}:[email protected]:6697/#chef_events",
:message => line,
:join => false,
:ssl => true
)
end
end
Chef::Config[:event_handlers] = [Chef::EventDispatch::Irchandler.new]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment