[Pkg-puppet-devel] Bug#571127: etckeeper integration with puppet pre/post commit hooks
Mathias Gug
mathiaz at ubuntu.com
Tue Feb 23 18:00:22 UTC 2010
Package: puppet
Version: 0.25.4-2
Severity: wishlist
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu lucid ubuntu-patch
*** /tmp/tmpc9TUKP
In Ubuntu, we've applied the attached patch to achieve the following:
* etckeeper integration (server-lucid-puppet-etckeeper-integration):
- debian/etckeeper-commit-post, debian/etckeeper-commit-pre:
+ Call "etckeeper commit" before and after catalog runs.
Silently bail out if etckeeper is not available.
- debian/puppet.conf:
+ Call out to the etckeeper hooks using the new prerun_command,
and postrun_command hooks.
- debian/rules:
+ Install the etckeeper hook scripts in /etc/puppet.
We thought you might be interested in doing the same.
-- System Information:
Debian Release: squeeze/sid
APT prefers lucid-updates
APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 'lucid')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24-25-server (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
=== modified file 'debian/changelog'
=== added file 'debian/etckeeper-commit-post'
--- debian/etckeeper-commit-post 1970-01-01 00:00:00 +0000
+++ debian/etckeeper-commit-post 2010-02-23 17:53:37 +0000
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+which etckeeper > /dev/null 2>&1 || exit 0
+
+etckeeper commit "committing changes in /etc after puppet catalog run"
+
+# Failure of etckeeper should not be fatal.
+exit 0
=== added file 'debian/etckeeper-commit-pre'
--- debian/etckeeper-commit-pre 1970-01-01 00:00:00 +0000
+++ debian/etckeeper-commit-pre 2010-02-23 17:53:37 +0000
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+which etckeeper > /dev/null 2>&1 || exit 0
+
+etckeeper commit "saving uncommitted changes in /etc prior to puppet catalog run"
+
+# Failure of etckeeper should not be fatal.
+exit 0
=== modified file 'debian/puppet.conf'
--- debian/puppet.conf 2010-02-16 06:30:55 +0000
+++ debian/puppet.conf 2010-02-23 17:53:37 +0000
@@ -6,3 +6,5 @@
factpath=$vardir/lib/facter
pluginsync=true
templatedir=$confdir/templates
+prerun_command=/etc/puppet/etckeeper-commit-pre
+postrun_command=/etc/puppet/etckeeper-commit-post
=== modified file 'debian/rules'
--- debian/rules 2010-02-16 14:39:11 +0000
+++ debian/rules 2010-02-23 17:53:37 +0000
@@ -67,6 +67,12 @@
$(INSTALL) -m0644 ext/emacs/puppet-mode.el \
$(CURDIR)/debian/puppet-el/usr/share/emacs/site-lisp/puppet-mode.el
+ # etckeeper integration
+ $(INSTALL) -m0755 debian/etckeeper-commit-pre \
+ $(CURDIR)/debian/puppet/etc/puppet/etckeeper-commit-pre
+ $(INSTALL) -m0755 debian/etckeeper-commit-post \
+ $(CURDIR)/debian/puppet/etc/puppet/etckeeper-commit-post
+
dh_installexamples examples/*
$(INSTALL) -d -m0775 $(pkgconfdir)/templates
More information about the Pkg-puppet-devel
mailing list