Giter Site home page Giter Site logo

Hook/Plugin System about oxidized HOT 11 CLOSED

ytti avatar ytti commented on May 27, 2024
Hook/Plugin System

from oxidized.

Comments (11)

ytti avatar ytti commented on May 27, 2024

We probably should support several configurable hooks. And configuration changes is definitely one of them.

from oxidized.

sts avatar sts commented on May 27, 2024

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.

from oxidized.

ytti avatar ytti commented on May 27, 2024

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.

from oxidized.

MrRJ45 avatar MrRJ45 commented on May 27, 2024

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.

from oxidized.

SaaldjorMike avatar SaaldjorMike commented on May 27, 2024

👍 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.

from oxidized.

laetrid avatar laetrid commented on May 27, 2024

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.

from oxidized.

ytti avatar ytti commented on May 27, 2024

@sts can you test this?

https://github.com/ytti/oxidized/tree/feature-hook

from oxidized.

aakso avatar aakso commented on May 27, 2024

@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

from oxidized.

aakso avatar aakso commented on May 27, 2024

You can also implement hooks in Ruby by subclassing Oxidized::Hook and implementing run_hook(ctx) method.

from oxidized.

jthunt avatar jthunt commented on May 27, 2024

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.

from oxidized.

ytti avatar ytti commented on May 27, 2024

Released in 0.8.0

from oxidized.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.