Add hooks for running ruby blocks before/after a backup run. #342

wants to merge 7 commits into


None yet
3 participants

Sometimes you need to do some tricky things to put your system into a proper state for backup. This patch adds hooks for scripting these setup and teardown tasks right in your model's config.

More specifically, it adds these DSL methods:, 'back up procedure with before/after hooks') do
  before do |model|
    # a ruby block for setup

  after do |model|
    # a ruby block for teardown

  # the rest of your configuraiton

These hooks will be called right after logging the 'backup started' message and right before the 'backup finished' message.

Each hook also logs its own start, finish, or error messages.

Tests included.

Brian D. Burns and others added some commits Jun 7, 2012

Brian D. Burns omit -pass option in decrypt command if --password-file not given 4c66ebc
@szajbus szajbus Removed explicit pushing models to Backup::Model.all
Model initializer already adds instance to Backup::Model.all array,
so adding it explicitely in before block caused Backup::Model.all
to contain duplicates.
@szajbus szajbus Fixed wildcard matching
Model.find_matching returns model instances, but CLI::Utility.perform
method expects triggers. Added extracting triggers from matching models
before trying to perform backups.
Michael van Rooijen Merge pull request #339 from jdutil/bump_fog
Bump fog dependency to 1.4.0.
@thedeeno thedeeno add 'before' and 'after' hooks wrapping model definitions with custom…
… bits of code. Useful adding setup/tear-down to your backup config.
@thedeeno thedeeno clean up hook api 29bd7ae
@thedeeno thedeeno add start/stop/err logging for hooks 9690c77

... and apparently I should have made a feature branch (whoops). If it's a problem I can repackage.

agoddard commented Jan 3, 2013

+1 (though maybe 'cause it's been so long, could be worth cleaning up the commits to just include the hook specific ones)

ghost closed this in 8642d95 May 24, 2013

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment