12.08.2010 13:03, Jean Baptiste FAVRE пишет:
Hello list,
I'm planning to deploy and use Puppet at work.
For this, I've set up a SVN server to keep track of all changes in
modules & manifests.

Reading documentation to be able to define coding rules, I want to put
some SVN hooks to ensure for correct syntax and coding rules respect.

Does anybody here use such scripts ? Are some public version available ?
Or am I wrong going this way ?

You're on a good way.
I'm using pre-commit hook to check syntax on FreeBSD, so you should to check path

#!/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 /tmp/XXXXX`
export HOME=/
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
SVNLOOK=/usr/local/bin/svnlook
PUPPET=/usr/local/bin/puppet

$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



Regards,
JB



--
Alexander Kriventsov

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to