Skip to content

Instantly share code, notes, and snippets.

@jhulten
Created January 26, 2009 19:10
Show Gist options
  • Save jhulten/52917 to your computer and use it in GitHub Desktop.
Save jhulten/52917 to your computer and use it in GitHub Desktop.
#!/bin/sh
REPOS="$1"
TXN="$2"
LOG=`/usr/bin/svnlook log -t "$TXN" "$REPOS"`
# Check permissions to commit based on policy in /var/svn/svnperms.conf
/usr/bin/python /opt/svn/scripts/svnperms.py -r $REPOS -t $TXN -f /opt/svn/svnperms.conf || exit 1
# Check for conflict markers
/opt/svn/scripts/detect-merge-conflicts.sh $REPOS $TXN || exit 1
tmpfile=`mktemp`
export HOME=/
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
/usr/bin/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
exit 0
svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
err: Could not parse for environment production: Unknown function mysql_password at /tmp/tmp.XbAzeB7275:10
Puppet syntax error in puppet/modules/mysql/manifests/init.pp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment