Simon-

As stated, the class you're setting is global in scope.  However, the test for 
the existence of the class might not be redundant, depending on what exactly 
you _really_ want to do.

My suggestion is to use classes whose names are also base on the parameter 
variable, i.e., if_repaired("echo_$(name)_run").  This means that you will no 
longer be able to use the prefix-class notation, but you can still use an 
ifvarclass => "echo_$(name)_run" attribute instead.

-Dan

On Jan 25, 2012, at 1:51 AM, no-re...@cfengine.com wrote:

> Forum: CFEngine Help
> Subject: Re: methods, usebundle and loops
> Author: toddnni
> Link to topic: https://cfengine.com/forum/read.php?3,24644,24645#msg-24645
> 
> Hi Simon,
> 
> only problem that I see is here
> 
> commands:
>  !echo_run::
>    "/usr/bin/echo $(name)"
>    classes => if_repaired("echo_run");
> 
> because classes => if_repaired() defines global class, which will be already 
> defined when the another bundle runs. Local classes and variables are (to my 
> understanding) always cleared when the bundle is ran second time.
> 
> PS. I addition I think that !echo_run:: is redundant, because cfengine 
> doesn't run the same promise twice.
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine

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

Reply via email to