Skip to content

Instantly share code, notes, and snippets.

@darrinholst
Created March 27, 2012 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darrinholst/2219405 to your computer and use it in GitHub Desktop.
Save darrinholst/2219405 to your computer and use it in GitHub Desktop.
class Chef
class Resource
class Deploy < Chef::Resource
def on_start(arg=nil, &block)
arg ||= block
set_or_return(:on_start, arg, :kind_of => [Proc, String])
end
def on_complete(arg=nil, &block)
arg ||= block
set_or_return(:on_complete, arg, :kind_of => [Proc, String])
end
def on_error(arg=nil, &block)
arg ||= block
set_or_return(:on_error, arg, :kind_of => [Proc, String])
end
end
end
end
class Chef
class Provider
class Deploy < Chef::Provider
alias :old_deploy :deploy
def deploy
begin
callback(:on_start, @new_resource.on_start)
old_deploy
callback(:on_complete, @new_resource.on_complete)
rescue => e
callback(:on_error, @new_resource.on_error)
raise e
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment