Forum: CFEngine Help
Subject: getindices with an array of lists
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,24975,24975#msg-24975

I've seen this discussed here recently but I don't recall any firm proclamation 
as to whether this is possible.

body common control {

    bundlesequence => {
        "main",
    };

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

bundle agent main {

    vars:
    
        "shorewall" slist => {

"#ZONE   INTERFACE       BROADCAST        OPTIONS",
"inet    br0             detect          bridge",
"priv    virbr0          detect          bridge",

        };

        "shorewall" slist => {

"fw     firewall",
"inet   ipv4",
"priv   ipv4",

        };

    methods:

    "any" usebundle => test ( "main.shorewall" );

}

bundle agent test (shorewall){

    vars:

       "i" slist => getindices( "${shorewall}" ); 

    reports:

        cfengine::
            "${i} => ${shorewall[${i}]}";
}

ettin:~/inputs# cf-agent -Kf ./array.cf 
R: interfaces => ${shorewall}
R: zones => ${shorewall}


I was hoping to have the agent iterate of the lists inside the array.  Is this 
possible?  Have done it wrong?

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

Reply via email to