On 16 dec. 2011, at 10:47, <no-re...@cfengine.com> <no-re...@cfengine.com> 
wrote:

> Forum: CFEngine Help
> Subject: Re: CFEngine Help: Thoughts about some cfengine design decisions?
> Author: lauwersw
> Link to topic: https://cfengine.com/forum/read.php?3,24294,24325#msg-24325
> 
> Mark Burgess Wrote:
> -------------------------------------------------------
>> In CFEngine 3 syntax we have managed to reduce
>> 10,000 lines of code down 
>> to 1000 due to the absorption of irrelevancy using
>> the body templates. 
>> The interesting part of the code is not what all
>> of these attributes 
>> actually are, but what is the *intention*. Now we
>> can write
>> 
>>   "$(ftp)/usr/lib"
>>                perms => simple1,
>>     depth_search => simple2,
>>         copy_from => x("/usr/lib");
>> 
>> And you can sprinkle parameters where you want for
>> *clarity of 
>> communication*, not for programming necessity.
> ..
>> This does not mean that the discussion is over, as
>> there are plenty of 
>> things we can do to make CFEngine 3 even simpler
>> to understand. I hope 
>> to come back with something on this in the new
>> year.
> 
> I agree that while inlining parameters looks tempting, it will probably 
> create much harder to maintain code. On the other hand now we risk ending up 
> with tens of bodies, all looking very similar but being different in small 
> details. It isn't really a blocker for me to learn the cfengine3 language and 
> usually I can limit the number of different bodies. So I've got a bit mixed 
> feelings about this. 
> 
> Still somewhere (but I don't find it back) I've read a suggestion that a kind 
> of inheritance of bodies would be nice, and I like that idea. For example you 
> could have the basic copy_from bodies, but if you want them to use digest => 
> "true", you have to copy all of them and just add that parameter. I liked 
> that suggestion, though it might be hard to implement in a clear way.
> 


Maybe this can work,  introduce a for example a combine function  that can 
except multiple bodies statement and you can override the settings in settings 
e.g.:
  copy_from => combine( default( "$(g.policyserver)", "$(source_dir)"), 
set_digest)

first evaluate default and then digest and then …

Or another though will be to just use the keywords. So you can override the 
value:
 copy_from => defaults("$(g.policyserver)", "$(source_dir)",  digest=true)

--
Bas van der Vlies
b...@sara.nl



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

Reply via email to