help-cfengine
[Top][All Lists]
Advanced

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

parsing errors, syslog and alerts


From: nico (CCC)
Subject: parsing errors, syslog and alerts
Date: Fri, 23 Apr 2004 23:25:39 -0300

Hi,

I've found the following two ?bugs?.

I'm not very C proficient (less if its lex involved)
so I couldn't submit a patch but I think they are easy
to reproduce.

This is CFENGINE 2.1.5 on fedora.

Syslog alerts are always called (besides class)
===============================================
if an alert is defined to call syslog then
that syslog entry is generated always independently
of the class. If the class is defined then the log
entry is generated again (correctly this time)

# cat cfagent.conf
control:
   actionsequence = ( files )

alerts:
  problem::
        SysLog(LOG_ERR,"problem")
        "problem @ ${host}" ifelapsed=0

If we run:
# cfagent -q
nothing get printed BUT the following gets
to syslog:
Apr 23 20:12:15 alerce1 cfagent:  problem

If we run:
#cfagent -q -D problem 
we get to stdout:
cfengine:alerce1: problem @ alerce1

and sylog gets:
Apr 23 20:13:31 alerce1 cfagent:  problem
Apr 23 20:13:31 alerce1 cfengine:alerce1[17258]:  problem

Looking quickly at the sources *maybe* is that the parser
evaluates syslog() as function and executes it at parsing
time and later it is executed correctly.



double definition of alerts:
===========================

if an alert is defined last in a cfagent.conf
which have imports, then it gets defined twice.

# cat cfagent.conf
import:
   any::            
       cf.groups # only group definitions      
         cf.main # only actionsequence         
alerts:
   someclass::
        "${host} done"

# cadent -v -q -d 3 -D some class
GNU Configuration Engine - 
2.1.5
...
...
------------------------------------------------------------

DEFINED ALERTS

${host} done: if [someclass] ifelapsed 0, expireafter 0
${host} done: if [someclass] ifelapsed 0, expireafter 0
------------------------------------------------------------
...
...
---------------------------------------------------------------------
Alerts
---------------------------------------------------------------------

cfengine:alerce1: alerce1 done
cfengine:alerce1: alerce1 done
...
===============

The interesting things are:
if we add something else like a shellcommands:
after the alerts section in cfagent.conf, then 
everything is OK.
if there are no imports then also is OK.
My guess is that somehow a pending action don't
get cleared when you enter a new imported file.

Hope this helps.
and THANKS!

Nico


Attachment: log-run.txt
Description: Text document


reply via email to

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