Forum: CFEngine Help Subject: Interating over a list in an array Author: neilhwatson Link to topic: https://cfengine.com/forum/read.php?3,26354,26354#msg-26354
Consider this: newatson@ltipc682:~/.cfagent/inputs$ cat mlooops.cf body common control { bundlesequence => { "main", }; inputs => { "cfengine_stdlib.cf", }; } bundle agent main { methods: "any" usebundle => test; } bundle agent test { vars: "cname" slist => { "sky", "water", "neptune" }; "cname" slist => { "lava", "apple", "hat" }; "cname" slist => { "honey", "rose", "sol" }; "a" slist => getindices("cname"); reports: cfengine:: "${a} IN CNAME ${cname[${a}]}"; "blue IN CNAME ${cname}"; } newatson@ltipc682:~/.cfagent/inputs$ cf-agent -Kf ./mlooops.cf R: blue IN CNAME ${cname} R: red IN CNAME ${cname} R: yellow IN CNAME ${cname} R: blue IN CNAME sky R: blue IN CNAME water R: blue IN CNAME neptune Is there a way to have both the index and the list iiteration work? I've tried a few syntaxxc ombinaations but none have worked. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine