On Wed, 18 Apr 2012 11:35:01 +0200 Bas van der Vlies <b...@sara.nl> wrote: 

BvdV> I am using slist because configuration parameters can contain more then 
one value.  For most configuration files
BvdV> it is nice that a 'list' variable is repeated multiple times, eg:

BvdV> [%CFEngine BEGIN %]
BvdV> search $(template.cfg[resolv_search])
BvdV> [%CFEngine END %]

BvdV> result:
BvdV> search a
BvdV> search b
BvdV> search c

BvdV> But sometimes you just want all list variables on one line for example 
resolv.conf:
BvdV>  * search a b c

BvdV> I want to decided if a slist must be expand on one line or multiple 
lines. Sounds this reasobale?, eg:
BvdV> [%CFEngine BEGIN %]
BvdV> search join(" ', "$(template.cfg[resolv_search]"))
BvdV> [%CFEngine END %]

FWIW, the Perl Template Toolkit addresses this problem like so:

search [%CFEngine BEGIN %-]
 $(template.cfg[resolv_search]) [%CFEngine END %]

In other words, "%-" means "strip the following newline out of the
iteration".

Unfortunately it's very common to need a true CSV format with commas
between the quoted values like '"a","b","c"' and that's hard to express
in the current template language.

I've been using Template Toolkit for many years and its pseudo-language
is quite good; it would be very interesting to see a template plugin
system where ERB or Template Toolkit or whatever could be used against
specific passed variables.

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

Reply via email to