help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --parse-only issues


From: Edward F. Brown
Subject: Re: --parse-only issues
Date: Sun, 13 Mar 2005 13:01:31 -0700 (MST)
User-agent: SquirrelMail/1.4.4-2

> Hey all,
>
> I was trying to find a way to check the syntax if our cfengine files
> before we commit them in cvs. So far, it appears that --parse-only only
> works on files that are in /var/cfengine. Is there a way to override
> this and specific a location on the fly? I tried looking through the
> docs, but I just didn't see anything talking about it.


'-f' allows you to specify a file name.  You need to be explicit about the
path to the file, or it defaults to inputs, as you noted.  I.e.,
'./filename', rather than just 'filename'.

Here's a script I run on cvs commit of files in the inputs directory:

--------------------------------------------------------------------
 #!/bin/sh

# cfsyn_check: called by cvs commitinfo trigger (/var/CVS/CVSROOT/commitinfo)
#              return code determines whether commit is allowed
#              only run on files ending in '.cf'

for i in "$@"
do
        if echo "$i" |grep -q "\.cf"
        then
                sudo /usr/sbin/cfagent -pf ./$i
                if [ $? -ne 0 ]
                then
                        exit 1
                fi
        fi
done
------------------------------------------------------------------

This is the commitinfo trigger (.../CVSROOT/commitinfo):

# Check cfengine syntax before allowing commit
inputs          /usr/local/sbin/cfsyn_check %s

hope this helps,
Ed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]