[rudder-dev] Adding post-generation hooks for multi-purpose extensions

Jonathan Clarke jonathan.clarke at normation.com
Thu Apr 7 12:27:07 CEST 2016


Hi there,

An idea has come up in several discussions recently: after Rudder has 
generated promises for a node, it would be useful to be able to run some 
commands to either extend the basic check (cf-promises currently) or 
perform some extra operations.

A few examples:

 1. The obvious one: after generating CFEngine promises, we often want
    to validate them with cf-promises.
 2. A similar bonus one: after generating CFEngine promises for a node,
    we could check to make sure that any generic_cfengine_variables used
    are actually defined too, and fail if not (this would cause the
    generation to fail in the UI, making it easy for a user to find the
    error)
 3. Add extra data: inject some data file into the generated promises
    each time they change, like run a request to get node properties
    from Rudder's API and put them in a .csv/.json file in the promises
    directory


A simple implementation for this would be to create a directory 
structure under /opt/rudder/etc/hooks.d/, with sub-directories for each 
(future) hook type, the first being "promise-generation". This way, we 
could easily add other hook types later, such as node-first-seen, 
node-accepted, node-refused, node-to-relay.

The files in this directory would be run one by one, after promise 
generation, in the exact same way cf-promises is run today.

This idea would obviously be implemented in master (see our release 
features / bugs policy), but since the cf-promises command already 
exists in older versions, it could relatively easily be implemented in 
existing versions too.

Any thoughts, comments, suggestions?

Jon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rudder-project.org/pipermail/rudder-dev/attachments/20160407/f9d78e3e/attachment.html>


More information about the rudder-dev mailing list