Feature #2914

Transactions should have before and after hooks

Added by Luke Kanies 8 months ago. Updated 6 months ago.

Status:Closed Start:12/10/2009
Priority:High Due date:
Assigned to:Markus Roberts % Done:

0%

Category:agent
Target version:0.25.4
Affected version:0.25.1 Branch:luke/tickets/0.25.x/2914
Keywords:
Votes: 0

Description

There should be support within the transactions (really, within the Configurer class that runs the transaction) that allows running before and after hooks. It just involves having settings to allow specification of the hooks, and then support in the Configurer class that looks for the hooks and runs them if set.

This is specifically to enable etckeeper integration on Ubuntu:

https://wiki.ubuntu.com/PuppetEtcKeeperVCSIntegration https://blueprints.launchpad.net/ubuntu/+spec/server-lucid-puppet-etckeeper-integration

but I think it’ll be useful for much more.

Associated revisions

Revision cdcbdc78bc399a60afaf36b6267688e72081fb6e
Added by Luke Kanies 6 months ago

Fixing #2914 – pre/post hooks now work for transactions

This was built to be used with etckeeper to version control files in /etc, but can be used for essentially anything.

This patch was built to be added to 0.25.4, so it’s a least-modify approach. A better approach would be to refactor application/puppet.rb just a bit so it uses Configurer more.

This is a simple patch – it just defines ‘prerun_command’ and ‘postrun_command’ settings, and runs the appropriate command around each transaction if they’re set.

Signed-off-by: Luke Kanies luke@reductivelabs.com

History

Updated by James Turnbull 6 months ago

  • Assigned to set to Luke Kanies
  • Target version changed from 2.6.0 to 0.25.4

As part of the Ubuntu lucid release – this is a feature required for the etckeeper integration. Thoughts on whether this should end up in .4 as a result? (aware of the irony of breaching recent discussions on fixes versus features versus show-stoppers, etc)

Updated by Luke Kanies 6 months ago

  • Assigned to changed from Luke Kanies to Markus Roberts
  • Branch set to luke/tickets/0.25.x/2914

Fixed in the tickets/0.25.x/2914 branch in my repo.

Updated by James Turnbull 6 months ago

  • Status changed from Accepted to Closed

Pushed in commit:“cdcbdc78bc399a60afaf36b6267688e72081fb6e” in branch 0.25.x

Also available in: Atom PDF