1# Test that merging a multi level classic array works
2# Ref: https://dev.cfengine.com/issues/4566
3body common control
4{
5      inputs => { "../../default.cf.sub" };
6      bundlesequence => { default("$(this.promise_filename)") };
7}
8
9bundle agent check
10{
11   vars:
12      "a[0][class]"   string => "any";
13      "a[0][command]" string => "/bin/true";
14      "a[1][class]"   string => "linux";
15      "a[1][command]" string => "/bin/false";
16
17      "m" data => mergedata( a );
18
19      "i" slist => getindices( m );
20
21   classes:
22      "PASS" expression => strcmp( "any", "$(m[0][class])" );
23
24   reports:
25      PASS::
26         "$(this.promise_filename) Pass";
27      !PASS::
28         "$(this.promise_filename) FAIL";
29
30      DEBUG::
31        "i       => [$(i)]";
32        "class   => $(m[$(i)][class])";
33        "command => $(m[$(i)][command])";
34        "version => $(sys.cf_version)";
35}
36