help-cfengine
[Top][All Lists]
Advanced

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

Re: Ordering and cfengine 3 (was RE: Is this quirky for asimple copy, e


From: Adams, Russell L.
Subject: Re: Ordering and cfengine 3 (was RE: Is this quirky for asimple copy, editfiles operation?)
Date: Fri, 13 May 2005 15:29:22 -0500
User-agent: Mutt/1.4.2.1i

Why couldn't you do things like this now with lockfile?

Test for /.preserved, and set a class.

Its more verbose, nothing a little m4 couldn't solve.

Russell

On Fri, May 13, 2005 at 02:58:32PM -0500, Brendan Strejcek wrote:
> Brendan Strejcek wrote:
> 
> > Moore, Joe wrote:
> > 
> > > The trouble comes in that state is not preserved across cfengine
> > > invokations. The restart_inetd class that's defined when you editfiles
> > > /etc/inetd.conf won't be defined the next time cfengine runs.
> > >
> > > So one option for cfengine3 could be to preserve more state, and have
> > > actions explicitly clear that state... idea: classes that are defined
> > > by an action (using the new "set" keyword) are kept until they are
> > > cleared. (this might be implemented by a state DB or by giving them to
> > > cfenvd)
> > 
> > An interesting idea. One could think about this as exceptions that can
> > be raised during one cfagent run and handled in a subsequent run.
> > 
> > We might be able to do this now with:
> > 
> >     SetState("preserved_class",10,Preserve)
> >     SetState(non_preserved_class,60,Reset)
> >     UnsetState(myclass)
> > 
> > (See http://www.cfengine.org/docs/cfengine-Reference.html#alerts )
> > 
> > All those are used in the "alerts" sections, which would just be weird
> > to use for what you discuss above, not in the least because "alerts" is
> > one of those magic non-actionsequence actions.
> 
> Here are some code examples:
> 
>     $ cat preserve
>     #!/usr/sbin/cfagent -qKf
>     
>     control:
>         actionsequence = ( shellcommands )
>     
>     shellcommands:
>         any::
>             "/bin/echo setting a class"
>                 define=create_preserved
>         preserved::
>             "/bin/echo preserved set"
>                 define=remove_preserved
>     
>     alerts:
>         create_preserved::
>             SetState("preserved",999,Preserve)
>         remove_preserved::
>             UnsetState(preserved)
>     $ ./preserve
>     cfengine::/bin/echo setti: setting a class
>     $ ./preserve
>     cfengine::/bin/echo setti: setting a class
>     cfengine::/bin/echo prese: preserved set
>     $ ./preserve
>     cfengine::/bin/echo setti: setting a class
>     $
> 
> One could use this like:
> 
>     editfiles:
>         { /some/file
>             # SomeEdits
>             DefineClasses "restart_daemon:doublecheck_restart"
>         }
> 
>     shellcommands:
>         restart_daemon::
>             "/etc/init.d/daemon restart"
>                 define=clear_restart
>         restart_again::
>             "/etc/init.d/daemon restart"
>                 define=clear_restart
> 
>     alerts:
>         doublecheck_restart::
>             SetState("restart_again",999,Preserve)
>         clear_restart::
>             UnsetState(restart_again)
> 
> The idea that I tried to encode above was: "if we were not able to
> restart the daemon this time, try next time, and so on until we are
> successful."
> 
> I'm not sure exactly what the utility of this is, since I think that
> alerts happen after everything else, so if the run is interrupted, the
> "restart_again" class won't be set anyways.
> 
> It would also be nice if we could use "inf" as a duration as well, to
> force a set class to be manually cleared.
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine




reply via email to

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