help-cfengine
[Top][All Lists]
Advanced

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

PrepModule or actionsequence: Hobson's choice


From: Cedric Ware
Subject: PrepModule or actionsequence: Hobson's choice
Date: Fri, 8 Jul 2005 15:28:15 +0200
User-agent: Mutt/1.5.9i

        Hello,

I am trying to setup a cfengine configuration where classes are
defined by an external module (which should ultimately get them
from an inventory database).  Ideally, this external module could
use some classes predefined by cfengine, e.g. OS, IP subnet etc.

However, it seems that:
-- if the module is loaded by PrepModule, CFALLCLASSES is empty;
-- if the module is in the actionsequence, classes defined from
   other classes resulting from the module are never activated.

For example, if /tmp/cfengine/module:echo is:

#! /bin/sh
[ -n "$CFALLCLASSES" ] && echo +class_touch

and /tmp/cfengine/cfagent.conf is:

control:
  any::
    moduledirectory = ( /tmp/cfengine )
    actionsequence = ( module:echo shellcommands )
    AddInstallable = ( class_touch do_touch )

groups:
  any::
    gotinit = ( PrepModule(module:echo, "") )
    do_touch = ( class_touch )

shellcommands:
  do_touch::
    "/bin/touch /tmp/cfengine/touched"


then calling "env CFINPUTS=/tmp/cfengine cfagent" (or cfagent -u)
never executes the "touch" command.  If do_touch:: is replaced by
class_touch::, or if module:echo unconditionally outputs
+class_touch, then it runs fine.

I am running cfengine 2.1.14 on a Debian Sarge system.  Is there
anything I did wrong?  Any advice?

I suppose I could either rewrite the module so that it discovers
the classes by itself ("cfagent -f/dev/null -n -v | grep Defined",
maybe?), or make the configuration files so that they never use
a class from the module to define another class--which could get
awkward.  Any better ideas?

                                        Thanks in advance,
                                        Cedric Ware.




reply via email to

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