Hi Bas,
I don't think this can be done at the moment, other than by manually creating
the string variable and using it in the template. It would be nice, maybe open
a feature request?
--Diego
On Apr 18, 2012, at 4:35 AM, Bas van der Vlies wrote:
>
> For generation of configuration files i am using associative array with list
> values i have lot of them:
> * "cfg[domain_search]" slist => { "a", "b", "c" };
> * "cfg[ldap_netgroup]" slist => { "ou=Netgroups,dc=hpcv,dc=sara,dc=nl" },
> * ,,,
>
> I am using slist because configuration parameters can contain more then one
> value. For most configuration files
> it is nice that a 'list' variable is repeated multiple times, eg:
>
> [%CFEngine BEGIN %]
> search $(template.cfg[resolv_search])
> [%CFEngine END %]
>
> result:
> search a
> search b
> search c
>
> But sometimes you just want all list variables on one line for example
> resolv.conf:
> * search a b c
>
> I want to decided if a slist must be expand on one line or multiple lines.
> Sounds this reasobale?, eg:
> [%CFEngine BEGIN %]
> search join(" ', "$(template.cfg[resolv_search]"))
> [%CFEngine END %]
>
>
> I know i can convert a list to a string in cfengine:
> "domain_search_str" string => join(" ", "$(cfg)[domain_search]");
>
> But i have to convert all list variables to string variables and have to
> decide in the template file which variable to use. It would be nice if can
> decide what i want in the template file.
>
>
>
>
>
>
>
> --
> ********************************************************************
> * Bas van der Vlies e-mail: [email protected] *
> * SARA - Academic Computing Services Amsterdam, The Netherlands *
> ********************************************************************
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine