[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: --parse-only issues
From: |
Lance Albertson |
Subject: |
Re: --parse-only issues |
Date: |
Sun, 13 Mar 2005 14:16:25 -0600 |
On Sun, 2005-03-13 at 13:01 -0700, Edward F. Brown wrote:
> > 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
Thanks! Thats exactly what I was looking for. The only thing I noticed
is that I need to set CFINPUTS to the directory where these files are at
otherwise it wants to check the HOME directory.
Cheers!
--
Lance Albertson <ramereth@gentoo.org>
Gentoo Infrastructure | Operations Manager
---
GPG Public Key: <http://www.ramereth.net/lance.asc>
Key fingerprint: 0423 92F3 544A 1282 5AB1 4D07 416F A15D 27F4 B742
ramereth/irc.freenode.net
signature.asc
Description: This is a digitally signed message part