Closed sts closed 9 years ago
We probably should support several configurable hooks. And configuration changes is definitely one of them.
So we would need a plugin system, something like this
class Oxidized::Hook
@hooks = []
def register(type, block)
end
def execute(type)
end
end
Oxidized::Hook.register :post_commit do
`git-commit-notifier`
end
Oxidized::Hook.execute :post_commit
register would record a new user defined hook, and execute would run all available hooks from the hookable code points. Can you create a list of code points you think would be worth hooking in?
Also I think we should alos expose this via the configuration file somehow.
Absolutely. We need people to be able to set arbitrary URL or ruby class to be called on hook triggered, someone asked about this in IRC recently.
13:20 <+kll> ytti: does oxidized have callbacks on configuration changes? (quick peak at github tells me no)
This is definitely something many will find useful.
This would be very nice to have. The ability to execute an external binary/script would be nice, with the ability to pass it arguments, such as the device name, ip, etc.
:+1: for a hook system. I could really use a pre-commit hook to do some cleanup in configuration before committing any changes. Also a post-commit hook to push to a remote repository would also be of interest to me.
Hello! Any advance in configuration changes notification? Now I use http://git-scm.com/docs/git-send-email for this purpose, but it isn`t really convenient.
@sts can you test this?
@sts and @ytti here is the example configuration for using the Exec hook:
hooks:
do_smth:
type: exec
events: [post_store, node_fail]
cmd: 'env >> /tmp/oxiexec.txt'
timeout: 120
async: true
You can also implement hooks in Ruby by subclassing Oxidized::Hook
and implementing run_hook(ctx)
method.
Since I haven't replaced my production rancid with Oxidized yet (still waiting on the custom ports), I installed the feature-hook branch on my test box. It is working well with a shell script I created to run git-commit-notifier against the git repo on post_store.
Released in 0.8.0
We want to be notified for configuration changes at our devices. I cannot use GIT hooks for that purpose, since they don't trigger on a bare repository as its initialised by Oxidized.
There is https://github.com/git-commit-notifier/git-commit-notifier which will create good looking change e-mails, which I would like to use for that purpose. We could probably just initiate it after creating the rugged commit oxidized/output/git.rb.
What are your thoughts?