Forum: CFEngine Help
Subject: Re: Build an slist from an array of slists
Author: nickanderson
Link to topic: https://cfengine.com/forum/read.php?3,27036,27048#msg-27048
juriskrumins Wrote:
-------------------------------------------------------
> I believe following code will be the correct right
> one.
>
> ...
> "values1" slist => { "@(array[$(keys)])",
> "@(values)" },
> policy => "ifdefined";
> ...
>
Then I would expect the list would never contains more than the list of the
current iteration of array keys list, it would be redefined each iteration.
I wanted to end up with a list like this.
"values" slist => {"key1_value1", "key1_value2", "key2_value1", "key2_value2"};
As for what prompted this, I was toying around with different ideas for ssh key
management sketch after someone was having problems when a key was not present
having the variable inserted into their authorized keys file or something.
One api for describing users and keys I had was something like this.
vars:
"ssh_pubkeys" slist => { "key1", "key2" };
"ssh_pubkeys" slist => { "key2", "key3" };
I was thinking I was going to raise a class for each key that was present. It
crossed my mind to raise a class like username_keyname_present. I might be
checking the same key multiple times for different users and since a list can
only contain one instance of a value I figured I would just get all of the keys
into a single list, test validity and raise classes. Not sure if thats 100%
accurate recollection it was just a passing thought but I was curious to know
if a workable pattern existed to append to a list like that.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine