Forum: CFEngine Help
Subject: Re: multidimensional array usage
Author: victor
Link to topic: https://cfengine.com/forum/read.php?3,23753,23756#msg-23756

Hello Diego,

Thanks a lot for your fast reply. I'm not sure if i'm doing something wrong, 
but it doesn't work:


bundle agent  parse_array
{
        vars:
                "dim"                   int => readstringarray("servers", 
"/tmp/servers.txt","\s*#[^\n]*",":",100,10000),
                                        comment => "Get all the server params 
for configurations";
  "hostnames" slist => getindices("servers");
  "ip_array[$(hostnames)]" string => "$(servers[$(hostnames)][1])";
  "ip_slist" slist => getvalues("ip_array");

        reports:
                cfengine_3:: 
                                                                                
            
                        "ips $(ip_slist)";

}



I don't get any report output. I tried changing "ip_slist" slist => 
getvalues("ip_array"); by "ip_slist" slist => getindices("ip_array"); it also 
doesn't show anything in the report. If i change the report to:

                        "ips: $(ip_array[$(hostnames)])";

It works, but i still don't have the slist with the IPs.

Any ideas on what could i be doing wrong?

Thanks a lot.
Regards.

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

Reply via email to