Forum: CFEngine Help
Subject: Build an slist from an array of slists
Author: nickanderson
Link to topic: https://cfengine.com/forum/read.php?3,27036,27036#msg-27036

I am drawing a blank on this atm. How can I build a single list from an array 
of lists.

I tried this 

body common control {

    bundlesequence => {"main"};

    inputs => {"cfengine_stdlib.cf"};
}

bundle agent main {
vars:
  "array" slist => { "key1_value1", "key1_value2" };
  "array" slist => { "key2_value1", "key2_value2" };
  "keys" slist => getindices("array");
  
  "values" slist => { "@(array[$(keys)])", "@(values)"  },
    policy => "ifdefined";
    
reports:
  cfengine::
    "$(values)";
}


But I got an error about the list containing itself.

Scalar variable "values" contains itself (non-convergent): @(values)
Variable "values" contains itself indirectly - an unkeepable promise


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

Reply via email to