[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: --parse-only issues
From: |
Russell Adams |
Subject: |
Re: --parse-only issues |
Date: |
Sun, 13 Mar 2005 19:29:54 -0600 |
User-agent: |
Mutt/1.4.2.1i |
I'm on 2.1.0p1, and I've had some problems where the parse mode failed
to catch an errors that caused cfengine to die at execution time.
One good example was an extra EndGroup in an editfiles statement,
where parse returned clean, but cfagent died running it.
Russell
On Sun, Mar 13, 2005 at 02:16:25PM -0600, Lance Albertson wrote:
> 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
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
-----------------------------
Russell Adams
RLAdams@AdamsInfoServ.com
http://www.adamsinfoserv.com/