Forum: CFEngine Help
Subject: Contrived example : getindices returns an empty list
Author: jbd
Link to topic: https://cfengine.com/forum/read.php?3,27120,27120#msg-27120

Hello everybody,

i'm running CFEngine 3.3.5.

I've build the following contrived example, and I don't understand why the 
imyarray list is empty (Also available here with the verbose cfagent output : 
https://gist.github.com/3496634) :


body common control                                                             
     
{                                                                               
     
bundlesequence  => { "test" };                                                  
     
}                                                                               
     
                                                                                
     
bundle agent test                                                               
     
{                                                                               
     
    vars:                                                                       
     
    "indices" slist => { "a", "b", "c", "d" };
    "indices_$(indices)" string => "$(indices)";
    "myarray[$(indices_$(indices))]" string => "$(indices)";
    "imyarray" slist => getindices("myarray");

    reports: 
    cfengine_3::
    "myarray  : $(myarray[$(indices_$(indices))])";
    "imyarray : $(imyarray)";
} 


Output :

# cf-agent -K -f ./test.cf                                                      
                                                                                
                             
R: myarray  : a                                                                 
                                                                                
                                                   
R: myarray  : b                                                                 
                                                                                
                                                   
R: myarray  : c                                                                 
                                                                                
                                                   
R: myarray  : d


Any idea ?

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

Reply via email to