On Friday 17 Sep 2010 11:22:08 Bas van der Vlies wrote:

> On 17-09-10 11:57, Davide Brini wrote:
> > On Friday 17 Sep 2010 10:38:49 Mark Burgess wrote:
> >> This is for dynamical classes set while the config is running.
> > 
> > Thanks. Any way to do what I'm trying to do then? Basically I'd like to
> > be able to, say, touch a file and have the agent do nothing if it finds
> > that file (I know I can do that by changing the exec_command or
> > switching to cron, but I'm curious to see if there's something like that
> > built-in).
> 
> we have this bundel for cfengine3:
> 
> bundle agent stop_cfengine
> {
>          vars:
>                  "file" string => "/etc/no_cfengine",
>                     comment => "If this file exists abort cfengine run";
> 
> 
>          classes:
>                  "stop_cfengine" expression => fileexists( $(file) );
> 
>          reports:
>                  stop_cfengine::
>                          "CFengine is not allowed to execute: $(file)";
> }
> 
> body agent control
> {
>          ifelapsed           => "1";
> 
>          abortclasses => { "stop_cfengine" };
> 
>          debian::
>                  default_repository => "/var/lib/cfengine3/repository";
> 
> }
> 
> Just add stop_cfengine to the bundle sequence. To prevent cf-agent from
> running just touch the file.

Thanks, that works. I was basically doing the same thing, except I had it 
inside an already-existing bundle, eg

bundle agent main {
   classes:
       "stopnow" expression => fileexists("/etc/nocfrun");

   # rest of bundle here....
}

but obviously that must be somehow different from they way you suggested, 
because mine was not working (despite setting the class).

Thank you!

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

Reply via email to