help-cfengine
[Top][All Lists]
Advanced

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

inconsistent exit codes during parse errors


From: Jamie Wilkinson
Subject: inconsistent exit codes during parse errors
Date: Tue, 25 Feb 2003 15:13:49 +1100
User-agent: Internet Messaging Program (IMP) 3.1

I've concocted a hideous script that does a cfagent -p on the input files when
committed to the cvs repository, as a simple check that the inputs are at least
going to parse when they get to the machines on the network.

However, I've just noticed that the commit test script stopped working -- it
would report an error in the parse, then continue on and let CVS check in the
broken file.

I tracked it down -- cfagent doesn't always return non-zero when it reports an
error with the config files.

In my case, it was reporting an "Illegal directory attribute" and returning 0. 
The section in question was:

directories:

  all::

    /var/lib/anchor-backup
      owner=bu_protect
      group=bu_protect
      mode=0700
      action=fixall

and it was complaining about the line "action=fixall".    

I suspect there are other cases where cfengine reports a syntax or parse error
and doesn't return non-zero, because I've seen it occur with other parse
errors... but unfortunately I didn't keep a record of them.  The thing is, that
sometimes the script did work, that cfagent returned a non-zero code on some
parse errors.

Would it be possible to ensure that all fatal parse errors explicitly exit with
non-zero?  I've worked around this in my commit script with a fairly hideous
hack -- saving the output of cfagent -p and testing if the length of the file is
greater than zero, but I'm sure you understand that's not robust.

Thanks.

Jamie




reply via email to

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