help-cfengine
[Top][All Lists]
Advanced

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

Re: Editfiles DefineClasses does not seem to work


From: David J. Bianco
Subject: Re: Editfiles DefineClasses does not seem to work
Date: 12 Aug 2002 13:37:06 -0400

On Mon, 2002-08-12 at 13:09, ABostick@mydoconline.com wrote:
> I am trying to define a class based on the edit of a file with
> DefineClasses.  I use editfiles to edit my crontab, but the dynamic class
> does not get instantiated.  I am trying to trigger a HUP to cron based on
> the edit of a crontab but with no luck...
> 
> Is this an unimplemented feature or known bug?
> 

It works for me in several places.  I do something like the following:


-------------------------------------------------
control:

   AddInstallable = ( CFE_INIT_CHANGED CFE_CRONTAB_MODIFIED )

editfiles:

# Create a crontab entry to run cfagent on a regular basis.  
# If we end up having to edit the crontab because the lines aren't
# already there, define CFE_CRONTAB_MODIFIED so we can restart cron
# later.
   linux::

      { /var/spool/cron/root

         Backup yes
         AutoCreate
         Inform yes
         DefineClasses "CFE_CRONTAB_MODIFIED"

         BeginGroupIfNoLineMatching "0,30.*restart-cfexecd.*"
            Append "0,30 * * * * /var/cfengine/bin/restart-cfexecd"

         EndGroup
      }

shellcommands:

  # If we modified the crontab file in the editfiles section, restart
   # cron right now to read in the new entries
   linux.CFE_CRONTAB_MODIFIED::
      "/etc/rc.d/init.d/crond restart" preview=false umask=022

-------------------------------------------------

You probably just need to add the AddInstallable statement like
mine above.  If you dynamically define classes during runtime, 
cfengine needs to know about them first.  The cfagent actually
iterates over each type of action up to 5 (I think) times to 
make sure that all possible actions are performed.  If you don't
use AddInstallable, cfengine might not know that it's possible for
a certain class to be defined at run time, so it might incorrectly
compute that all possible actions have been taken for a given 
stanza.  You can get a better explanation from the AddInstallable
documention on the web site, but this sounds like it might be all
you need.

        David

-- 
David J. Bianco, GSEC           <bianco@jlab.org>
Thomas Jefferson National Accelerator Facility

     The views expressed herein are soley those of the author and
            not those of SURA/Jefferson Lab or the US DOE.





reply via email to

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