Hi Guys,

I am new to puppet so please let me know if this is not the correct place 
for asking this question.  I am setting up a new puppet environment running 
the latest 3.x version.  I have the puppet master and client setup 
correctly and tested with deploying a simple file to the client.  Now, I am 
working on adding all the configs to SVN since I will have all my users 
checkout the nodes.pp file and place their node entries in this file via 
SVN.  I would like to do some check on this file before it is checked in to 
make sure there are no syntax errors.  I am using the following pre-commit 
scirpt that I came across online:

--
#!/bin/bash

REPOS="$1"
TXN="$2"
tmpfile=$(mktemp)
export 
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

for file in $(svnlook changed -t "$TXN" "$REPOS" | awk '/^[^D].*\.pp$/ 
{print $2}')
do
        svnlook cat -t $TXN $REPOS $file > $tmpfile
        puppet parser validate  $tmpfile &>/dev/null
        if [ $? -ne 0 ]
        then
                echo "Puppet syntax error in $file" 1>&2
                exit 1
        fi
done
--

Here is my nodes.pp file that is being edited:

--
node 'testrhel.gene.com' { include simtestfile }
--

Now with this node.pp file I am able to update the testrhel server with the 
simtestfile just fine and the puppet parser validate command does not 
complain if I run it manually:

--
[root@ssfpuppetd01 hooks]# puppet parser validate 
/etc/puppet/manifests/nodes.pp
[root@ssfpuppetd01 hooks]# 
--

However, now when I try to svn ci this file I get an error and it looks 
like it is because the above command returns a 1 for some reason:

--
..snip..
Sending        nodes.pp
Transmitting file data .svn: Commit failed (details follow):
svn: Commit blocked by pre-commit hook (exit code 1) with output:
+ REPOS=/var/svn/repos/puppet
+ TXN=30-28
++ mktemp
+ tmpfile=/tmp/tmp.EmWYD21813
+ export 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
+ 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
++ svnlook changed -t 30-28 /var/svn/repos/puppet
++ awk '/^[^D].*\.pp$/ {print $2}'
+ for file in '$(svnlook changed -t "$TXN" "$REPOS" | awk 
'\''/^[^D].*\.pp$/ {print $2}'\'')'
+ svnlook cat -t 30-28 /var/svn/repos/puppet manifests/nodes.pp
Sending        nodes.pp
Transmitting file data .svn: Commit failed (details follow):
svn: Commit blocked by pre-commit hook (exit code 1) with output:
+ REPOS=/var/svn/repos/puppet
+ TXN=30-28
++ mktemp
+ tmpfile=/tmp/tmp.EmWYD21813
+ export 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
+ 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
++ svnlook changed -t 30-28 /var/svn/repos/puppet
++ awk '/^[^D].*\.pp$/ {print $2}'
+ for file in '$(svnlook changed -t "$TXN" "$REPOS" | awk 
'\''/^[^D].*\.pp$/ {print $2}'\'')'
+ svnlook cat -t 30-28 /var/svn/repos/puppet manifests/nodes.pp
*+ puppet parser validate /tmp/tmp.EmWYD21813*
*+ '[' 1 -ne 0 ']'*
+ echo 'Puppet syntax error in manifests/nodes.pp'
Puppet syntax error in manifests/nodes.pp
+ exit 1
--

However, if I run that command manually it does not return any errors:
--
[root@ssfpuppetd01 hooks]# puppet parser validate /tmp/tmp.EmWYD21813
[root@ssfpuppetd01 hooks]# cat  /tmp/tmp.EmWYD21813
node 'testrhel.gene.com' {
include simtestfile
}
[root@ssfpuppetd01 hooks]#
--

Any help would be greatly appreciated.

Thanks,
-J

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/W2HkSI7z5FcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to