I recently added a Wiki explaining about Plugins in Foreman.
http://theforeman.org/projects/foreman/wiki/Plugins
Foreman plugins are used to add or modify functionality to Foreman without touching the core Foreman installation. Thus, users can easily upgrade Foreman when new versions are released without having to worry about porting their custom changes
A plugin may extend Foreman's models, controllors, and/or views. When you extend a Foreman model, you can use all standard hooks/callbacks that are available in Rails, such as
- before_create
- after_save
- after_destroy
- more at http://guides.rubyonrails.org/active_record_validations_callbacks.html#available-callbacks
For example, you can run a script "after_create" of a new host.
Additionally, I added two custom hooks on the Host model only, currently called:
- after_build - triggered when the host's "build" attribute is changed from "false" to "true".
- before_provision - triggered when the host's "build" attribute is changed from "true" to "false".
I'm looking for any feedback regarding the names of these custom hooks, since once people write plugins using them, they will be hard to change.
Thanks,
Joseph