Dear all,

In git I have a pre-receive script to checkt the puppet files. My git push 
comes with an error but if I run the same manually I get no error.
Can anybody please help me?

error message
remote:  Checking manifests/nodes.pp for syntax errors and styleguide 
compliance... 
remote: 'puppet parser validate' failed on manifests/nodes.pp - push 
deniend. Run tests locally and confirm they pass before pushing. 
remote: Error: Could not parse for environment production: No file(s) found 
for import of 'fix.pp' at /tmp/tmp.hujjYZKPpC/manifests/nodes.pp:9
remote: Error: Try 'puppet help parser validate' for usage

pre-receive script
for puppetmodule in `git diff-tree --no-commit-id --name-only -r $newrev`; 
do
        echo -e "\e[0;36m" "Checking $puppetmodule for syntax errors and 
styleguide compliance..." "\e[0m"
        tmpdir=`mktemp -d`
        tmpmodule="$tmpdir/$puppetmodule"
        tmperror="$tmpdir/errors.txt"
        mkdir -p $tmpmodule
        rmdir $tmpmodule
        git show $newrev:$puppetmodule > $tmpmodule
        case $puppetmodule in
                *.pp )
                puppet parser validate $tmpmodule 2&> $tmperror
                rc=$?
                if [[ $rc != 0 ]]; then
                                        echo -e "\e[0;31m'puppet parser 
validate' failed on $puppetmodule - push deniend. Run tests locally and 
confirm they pass before pushing. \e[0m"
                    cat $tmperror
                    rm -rf $tmpdir
                    exit $rc
                fi
 .....

this works without error in my local git and on the central git
puppet parser validate nodes.pp

cat nodes.pp 
node base {
  include profiles::base
}

node 'sv2629.muc.baag' inherits base {
}

import 'fix.pp'
import 'puppet_master.pp'
#import 'sunray.pp'

And it does not matter what I change in the file.

Best regards
Andreas

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e2d78e37-0746-4fed-b590-fd9246d4d605%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to