Forum: CFEngine Help
Subject: Re: CFEngine Help: Re: if assignment in cfengine
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,24461,24488#msg-24488

Mark Burgess Wrote:
-------------------------------------------------------
> Simon, with ifvarclass => you can make strings
> composed
> of variables, where with the context:: syntax you
> can't.
> 
> Personally i find
> 
>     context::
> 
> clearer, but the other is more flexible for
> "fancy" context handling.

Another big difference is that ifvarclass applies to a single promise, so it 
makes it for a cleaner structure when you have multiple nested conditions, for 
example:

topcondition::
   some common promise;
   some other promise;
   conditional promise
      ifvarclass => "subcondition1";
   conditional promise 2
      ifvarclass => "subcondition2";


Is easier to read IMO than:


topcondition::
   some common promise;
   some other promise;
topcondition&subcondition1::
   conditional promise
topcondition&subcondition2::
   conditional promise 2


The biggest advantage to me is the one Mark mentioned, that you can use 
variables in the class expression.

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

Reply via email to