Forum: CFEngine Help
Subject: Slists and looping
Author: random
Link to topic: https://cfengine.com/forum/read.php?3,24160,24160#msg-24160

I'm messing around with some simple looping over slists and ran into a problem 
with the code below.  It appears that cfengine isn't recursive when looping and 
won't expand my slists as I would expect.  Is there any work around for this or 
am I just doing it wrong?

Thanks!


body common control {
   bundlesequence => {
      "test"
   };
 
   inputs => {
      "cfengine_stdlib.cf"
   };
}
 
bundle agent test {
   vars:
      "test1" slist => { "one", "two", "three" };
      "test2" slist => { "three", "four", "five" };
      "test3" slist => { "athree", "afour", "afive" };

      "members" slist => { @(test1), @(test3) };

      "members" slist => { @(test2), @(test3) };

      "userlist" slist => getindices("members");
 
   reports:
      linux::
         "User: $(userlist) Element: $(members[$(userlist)])";

}


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to