Forum: CFEngine Help
Subject: arrays without brackets?
Author: davidlee
Link to topic: https://cfengine.com/forum/read.php?3,24118,24118#msg-24118

I suspect I'm overlooking something in the documentation.  If so, please point 
me in the right direction.

My understanding of arrays is based on the reference manual "2.7.4 Arrays in 
CFEngine 3".  The defining characteristic of the syntax seems to be square 
brackets:
---------

  vars:
    "array" string => "value1";
    "array" string => "value2";
    #etc.

    "indices" slist => getindices("array"); 

---------

Fine.  But over the months, and particularly in a forum thread here today, I 
seem to have seen another possibility:
--------

  vars:
    "sysctl" string => "net.ipv4.ip_forward = 0";
    "sysctl" string => "net.ipv4.conf.default.rp_filter = 1";
    # etc.

    "kernel_tunables" slist => getindices("sysctl");

---------

To me that looks just plain wrong: "sysctl" is surely a simple variable, not an 
array.  Yet I think I've seen this occasionally over the months, as though it 
is a a correct and accepted way of working.

Can someone point to the documentation that explains this syntax and way of 
working,  please?

Thanks.

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

Reply via email to