#!/bin/sh
# SVN pre-commit hook to check Puppet syntax for .pp files
# Modified from http://mail.madstop.com/pipermail/puppet-users/2007-March/002034.html
REPOS="$1"
TXN="$2"
tmpfile=`mktemp`
export HOME=/tmp
SVNLOOK=/usr/bin/svnlook
$SVNLOOK changed -t "$TXN" "$REPOS" | awk '{print $2}' | grep '\.pp$' | while read line
do
$SVNLOOK cat -t "$TXN" "$REPOS" "$line" > $tmpfile
if [ $? -ne 0 ]; then
echo "Warning: Failed to checkout $line" >&2
fi
puppet --color=false --confdir=/tmp --vardir=/tmp --parseonly --ignoreimport $tmpfile >&2
if [ $? -ne 0 ]; then
echo "Puppet syntax error in $line." >&2
exit 2
fi
done
res=$?
rm -f $tmpfile
if [ $res -ne 0 ]; then
exit $res
fi
#!/bin/sh REPOS="$1" REV="$2" PATH=/usr/bin:/bin PROJECT=puppet TO=to@domain.tldFROM=from@domain.tldsvn up /etc/puppet/ svn up /var/lib/puppet/manifests/development/ svn up /var/lib/puppet/manifests/testing/ svn up /var/lib/puppet/manifests/production/ svn up /var/lib/puppet/modules/development/ svn up /var/lib/puppet/modules/testing/ svn up /var/lib/puppet/modules/production/ # Note that --from is optional and if omitted the from address # will be $COMMITTER@$hostname # # If no --from is used, the committer may need to be subscribed # to the mailing list used in order for this message to be # accepted to the mailing list # svnnotify --repos-path "$REPOS" \ --revision "$REV" \ --smtp localhost \ --svnlook /usr/bin/svnlook \ --to $TO \--from $FROM \--subject-prefix "Puppet SVN Commit: " \ --with-diff --subject-cx --handler HTML::ColorDiff