Re: array of lists expansion

2012-06-25 Thread Marco Marongiu
Apologies, I spotted a few mistakes here: > I am preparing a policy to create authorized_keys files on a set of > server. read "servers" > Depending on which classes a server is in, it must get a > different set of keys in its authorized_keys file. I organized my stuff > this way: > > I have an

Re: array of lists expansion

2012-06-25 Thread Marco Marongiu
On 25/06/12 19:56, Nick Anderson wrote: > On 06/25/2012 12:50 PM, Marco Marongiu wrote: >> Summing up, the right way to expand a slist contained in an array >> element is actually: >> >> "list" slist => { "@(array[$(selector)])" } ; >> >> However, if you plan to use list as a parameter for a bundle

Re: array of lists expansion

2012-06-25 Thread Nick Anderson
On 06/25/2012 12:50 PM, Marco Marongiu wrote: > Summing up, the right way to expand a slist contained in an array > element is actually: > > "list" slist => { "@(array[$(selector)])" } ; > > However, if you plan to use list as a parameter for a bundle, you'd > better prefix the list expansion with

Re: array of lists expansion

2012-06-25 Thread Marco Marongiu
Thanks Nick I actually discovered that there was a dumb, but it was not the question: it was me :) Due to a well hidden bug in my code, the list expansion appeared not to be working. It took me some time, some runs of cf-agent -v, and an incremental set of changes in a bundle, to discover that th

Re: array of lists expansion

2012-06-25 Thread Nick Anderson
Here it is inline for the archives. body common control { bundlesequence => { "main", }; inputs => { "cfengine_stdlib.cf", }; } bundle agent main { vars: "array[key1]" slist => {"array1_key1_item1", "array1_key1_item2"}; "array[key2]" slist => {"array1_key2_item1", "array1_key2_item2

Re: array of lists expansion

2012-06-25 Thread Nick Anderson
On 06/25/2012 09:10 AM, Marco Marongiu wrote: > Hi all > > OK, I admit this must be *dumb*, but I cannot get out of this... > > Suppose I have an array of lists: > > "array[key1]" slist => { ... } ; > "array[key2]" slist => { ... } ; > . . . > "array[keyN]" slist => { ... } ; > > > and suppose that

array of lists expansion

2012-06-25 Thread Marco Marongiu
Hi all OK, I admit this must be *dumb*, but I cannot get out of this... Suppose I have an array of lists: "array[key1]" slist => { ... } ; "array[key2]" slist => { ... } ; . . . "array[keyN]" slist => { ... } ; and suppose that $(selector) contains one of the keys. Given that, I'd like to expa