Daniel Dehennin <[email protected]> writes: > Hello, > > I'm trying to create an array with list expansion and wonder why there > is no coordinated iteration. > > Here is my test case:
[...]
More tests:
#v+
body common control
{
bundlesequence => { "test" };
version => "0.0.6";
}
bundle agent test
{
vars:
"l1" slist => { "test1", "test2" };
"array1[$(l1)]" string => "array1_$(l1)";
"array2[test2]" string => "array2_test2";
"array2[test1]" string => "array2_test1";
"index1" slist => getindices("array1");
"index2" slist => getindices("array2");
reports:
Yr2011::
"Indexes for array1 are $(index1)";
"Indexes for array2 are $(index2)";
"Array1 test1 is $(array1[test1])";
"Array1 test2 is $(array1[test2])";
"Array 1 members are $(index1) => $(array1[$(index1)])";
"Array 2 members are $(index2) => $(array2[$(index2)])";
}
#v-
Resulting in:
#v+
bin/cf-agent -K -I
!! Redefinition of a constant list "index1"
cf3> -- Was {'cf_null'}cf3> now {'test1','test2'}cf3>
Promise (version 0.0.6) belongs to bundle 'test' in file
'/home/dad/.cfagent/inputs/promises.cf' near line 16
!! Redefinition of a constant list "index1"
cf3> -- Was {'cf_null'}cf3> now {'test1','test2'}cf3>
Promise (version 0.0.6) belongs to bundle 'test' in file
'/home/dad/.cfagent/inputs/promises.cf' near line 16
R: Indexes for array2 are test2
R: Indexes for array2 are test1
R: Array1 test1 is array1_test1
R: Array1 test2 is array1_test2
R: Array 2 members are test2 => array2_test2
R: Array 2 members are test1 => array2_test1
#v-
Is it normal for "array1" to be populated and index1 undefined?
Regards.
--
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
pgpC4EAkvdrkG.pgp
Description: PGP signature
_______________________________________________ Help-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/help-cfengine
