> 3. Classes in /var/cfengine/state/allclasses.txt,  but unspecific. It 
would be
 > straightforward to print out hard classes, but what for? How would 
you use them? I need to
 >   know to comment on whether there is a better way.

In my case (granted, still on CF-2), when running things like modules 
and the occasional support script, it is handy to be able to have these 
scripts have the same depth of knowledge about the system as cfagent 
itself does.  The ${cfallclasses} macro is awkward and breaks after 2048 
characters anyway.  There is also an environment variable, as far as I 
know, but parsing it is sometimes not particularly easy, and again there 
may be string length limitations on some shells.  But the allclasses.txt 
file is a great alternative in my opinion, since you can use simple 
tools like grep and awk to quickly and reliably determine whether a 
particular class is defined outside of cfagent.

I'll give an example.  In our case, we have cfagent setup to run at 
bootup and shutdown (with the 'bootup' and 'shutdown' classes defined, 
respectively) so that volatile configuration changes such as kernel 
upgrades can be done at a time when we know the machine is going to be 
rebooted.  These runs are accomplished using a standard init script in 
/etc/init.d that is effectively disconnected from cfagent; it's purpose 
in life is simply to run cfagent during boot and shutdown.

But if the allclasses.txt file (or a scriptable alternative) is 
available, then I can make the init script "smarter" about deciding 
whether to run at boot/shutdown or not.  Our cfengine policy takes about 
2-10 minutes to run through, depending on what changes have to be made. 
  When you're rebooting a machine, those 2-10 minutes can feel like an 
eternity.  But if the init script could be smart enough to know that 
(because class X is defined) that there aren't any volatile 
configuration updates to make, then it can simply skip the 
bootup/shutdown run, making rebooting of our systems that much less 
painful (and reducing the duration of downtimes in some cases).

Paul Krizak                         7171 Southwest Pkwy MS B200.3A
Senior Systems Engineer             Austin, TX  78735
Advanced Micro Devices              Desk:  (512) 602-8775
Linux/Unix Systems Engineering      Cell:  (512) 791-0686
Silicon Design Division             Fax:   (512) 602-0468

On 01/22/10 15:36, Mark Burgess wrote:

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to