Skip to content

Instantly share code, notes, and snippets.

@curiositycasualty
Created August 5, 2014 21:52
Show Gist options
  • Save curiositycasualty/2afde00b5eb2d93ed94a to your computer and use it in GitHub Desktop.
Save curiositycasualty/2afde00b5eb2d93ed94a to your computer and use it in GitHub Desktop.
Custom Generic Event Subscriber
log_location STDOUT
chef_server_url "https://isa-ec11-0-2-allitnil.opscode.us/organizations/allitnil"
validation_client_name "allitnil-validator"
# Using default node name (fqdn)
# can also be started using chef_handler more info at http://docs.getchef.com/handlers.html#run-from-client-rb
require '/etc/chef/foo'
event_handlers << YaySubscriber.new
require 'chef/event_dispatch/base'
class YaySubscriber < Chef::EventDispatch::Base
def run_start(version)
puts " >>>>>>run_start(#{version})\n"
end
def run_started(run_status)
puts " >>>>>>run_started(#{run_status})\n"
end
def run_completed(node)
puts " >>>>>>run_completed(#{node})\n"
end
def run_failed(exception)
puts " >>>>>>run_failed(#{exception})\n"
end
def ohai_completed(node)
puts " >>>>>>ohai_completed(#{node})\n"
end
def skipping_registration(node_name, config)
puts " >>>>>>skipping_registration(#{node_name}, #{config})\n"
end
def registration_start(node_name, config)
puts " >>>>>>registration_start(#{node_name}, #{config})\n"
end
def registration_completed
puts " >>>>>>registration_completed\n"
end
def registration_failed(node_name, exception, config)
puts " >>>>>>registration_failed(#{node_name}, #{exception}, #{config})\n"
end
def node_load_start(node_name, config)
puts " >>>>>>node_load_start(#{node_name}, #{config})\n"
end
def node_load_failed(node_name, exception, config)
puts " >>>>>>node_load_failed(#{node_name}, #{exception}, #{config})\n"
end
def run_list_expand_failed(node, exception)
puts " >>>>>>run_list_expand_failed(#{node}, #{exception})\n"
end
def node_load_completed(node, expanded_run_list, config)
puts " >>>>>>node_load_completed(#{node}, #{expanded_run_list}, #{config})\n"
end
def cookbook_resolution_start(expanded_run_list)
puts " >>>>>>cookbook_resolution_start(#{expanded_run_list})\n"
end
def cookbook_resolution_failed(expanded_run_list, exception)
puts " >>>>>>cookbook_resolution_failed(#{expanded_run_list}, #{exception})\n"
end
# returns everything, more info at https://github.com/opscode/chef/blob/master/lib/chef/event_dispatch/base.rb
#def cookbook_resolution_complete(cookbook_collection)
# puts " >>>>>>cookbook_resolution_complete(#{cookbook_collection})\n"
#end
def cookbook_clean_start
puts " >>>>>>cookbook_clean_start\n"
end
def removed_cookbook_file(path)
puts " >>>>>>removed_cookbook_file(#{path})\n"
end
def cookbook_clean_complete
puts " >>>>>>cookbook_clean_complete\n"
end
def cookbook_sync_start(cookbook_count)
puts " >>>>>>cookbook_sync_start(#{cookbook_count})\n"
end
def synchronized_cookbook(cookbook_name)
puts " >>>>>>synchronized_cookbook(#{cookbook_name})\n"
end
def updated_cookbook_file(cookbook_name, path)
puts " >>>>>>updated_cookbook_file(#{cookbook_name}, #{path})\n"
end
def cookbook_sync_failed(cookbooks, exception)
puts " >>>>>>cookbook_sync_failed(#{cookbooks}, #{exception})\n"
end
def cookbook_sync_complete
puts " >>>>>>cookbook_sync_complete\n"
end
def library_load_start(file_count)
puts " >>>>>>library_load_start(#{file_count})\n"
end
def library_file_loaded(path)
puts " >>>>>>library_file_loaded(#{path})\n"
end
def library_file_load_failed(path, exception)
puts " >>>>>>library_file_load_failed(#{path}, #{exception})\n"
end
def library_load_complete
puts " >>>>>>library_load_complete\n"
end
def lwrp_load_start(lwrp_file_count)
puts " >>>>>>lwrp_load_start(#{lwrp_file_count})\n"
end
def lwrp_file_loaded(path)
puts " >>>>>>lwrp_file_loaded(#{path})\n"
end
def lwrp_file_load_failed(path, exception)
puts " >>>>>>lwrp_file_load_failed(#{path}, #{exception})\n"
end
def lwrp_load_complete
puts " >>>>>>lwrp_load_complete\n"
end
def attribute_load_start(attribute_file_count)
puts " >>>>>>attribute_load_start(#{attribute_file_count})\n"
end
def attribute_file_loaded(path)
puts " >>>>>>attribute_file_loaded(#{path})\n"
end
def attribute_file_load_failed(path, exception)
puts " >>>>>>attribute_file_load_failed(#{path}, #{exception})\n"
end
def attribute_load_complete
puts " >>>>>>attribute_load_complete\n"
end
def definition_load_start(definition_file_count)
puts " >>>>>>definition_load_start(#{definition_file_count})\n"
end
def definition_file_loaded(path)
puts " >>>>>>definition_file_loaded(#{path})\n"
end
def definition_file_load_failed(path, exception)
puts " >>>>>>definition_file_load_failed(#{path}, #{exception})\n"
end
def definition_load_complete
puts " >>>>>>definition_load_complete\n"
end
def recipe_load_start(recipe_count)
puts " >>>>>>recipe_load_start(#{recipe_count})\n"
end
def recipe_file_loaded(path)
puts " >>>>>>recipe_file_loaded(#{path})\n"
end
def recipe_file_load_failed(path, exception)
puts " >>>>>>recipe_file_load_failed(#{path}, #{exception})\n"
end
def recipe_not_found(exception)
puts " >>>>>>recipe_not_found(#{exception})\n"
end
def recipe_load_complete
puts " >>>>>>recipe_load_complete\n"
end
def converge_start(run_context)
puts " >>>>>>converge_start(#{run_context})\n"
end
def converge_complete
puts " >>>>>>converge_complete\n"
end
def resource_action_start(resource, action, notification_type=nil, notifier=nil)
puts " >>>>>>resource_action_start(resource, action, notification_type, notifier)\n"
end
def resource_failed_retriable(resource, action, retry_count, exception)
puts " >>>>>>resource_failed_retriable(#{resource}, #{action}, #{retry_count}, #{exception})\n"
end
def resource_failed(resource, action, exception)
puts " >>>>>>resource_failed(#{resource}, #{action}, #{exception})\n"
end
def resource_skipped(resource, action, conditional)
puts " >>>>>>resource_skipped(#{resource}, #{action}, #{conditional})\n"
end
def resource_completed(resource)
puts " >>>>>>resource_completed(#{resource})\n"
end
def resource_current_state_loaded(resource, action, current_resource)
puts " >>>>>>resource_current_state_loaded(#{resource}, #{action}, #{current_resource})\n"
end
def resource_current_state_load_bypassed(resource, action, current_resource)
puts " >>>>>>resource_current_state_load_bypassed(#{resource}, #{action}, #{current_resource})\n"
end
def resource_bypassed(resource, action, current_resource)
puts " >>>>>>resource_bypassed(#{resource}, #{action}, #{current_resource})\n"
end
def resource_up_to_date(resource, action)
puts " >>>>>>resource_up_to_date(#{resource}, #{action})\n"
end
def resource_update_applied(resource, action, update)
puts " >>>>>>resource_update_applied(#{resource}, #{action}, #{update})\n"
end
def resource_updated(resource, action)
puts " >>>>>>resource_updated(#{resource}, #{action})\n"
end
def handlers_start(handler_count)
puts " >>>>>>handlers_start(#{handler_count})\n"
end
def handler_executed(handler)
puts " >>>>>>handler_executed(#{handler})\n"
end
def handlers_completed
puts " >>>>>>handlers_completed\n"
end
def provider_requirement_failed(action, resource, exception, message)
puts " >>>>>>provider_requirement_failed(#{action}, #{resource}, #{exception}, #{message})\n"
end
def whyrun_assumption(action, resource, message)
puts " >>>>>>whyrun_assumption(#{action}, #{resource}, #{message})\n"
end
def msg(message)
puts " >>>>>>msg(#{message})\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment