I am toying around with bundles that take an array paramater distill down the relevant parts and call out to other bundles that take an array paramater.
One of the cases I was messing around with is a three dimensional array "array[known][variable][variable]" string => "value" I know what the first key will be but the second and third keys are variable. I cant seem to figure out a pattern to create a two dimensional array from that. I would like to get to "newarray[variable][variable]" string => "value"; I can get the first key by doing getindices("array[known]") but I don't know how I could match the second key to the first key. The goal is to try and wrap up configuration information for a whole service into an array. So that might include configfile paths and users. Here is a contrived example, not syntactically correct but to illustrate the idea "service[configfile][acl]" string => "/etc/service/acl"; "service[configfile][passwd]" string => "/etc/service/passwd"; "service[acl][component1][user1]" string => "rw"; "service[acl][componentb][user2]" string => "r"; "service_config" usebundle => service_main("context.service"); bundle service_main(params){ vars: # c=component # u=user acl_conf[$(c)][$(u)] string => $(service[acl[$(c)][$(u)]) methods: "acl" usebundle service_acl("service_main.acl_conf"); } bundle service_acl(params){ configure the acls as defined } I definitely don't have to do it this way, but being able to wrap up multiple smaller reusable components and present them as a single interface seems useful. -- Nick Anderson <n...@cmdln.org> _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine