Forum: Cfengine Help Subject: Re: is it possible to combine arrays and lists? Author: Seva Gluschenko Link to topic: https://cfengine.com/forum/read.php?3,16807,16809#msg-16809
For unknown reason my reply by e-mail didn't appear here, so I copy it. Apologies for occasional duplicates if any. The thing is a bit more complicated indeed. I've just checked out my account space and found fresh 3.0.4p2 rpm packages there. So I've downloaded'em and upgraded my current installation. Currently reports section works as intented, showing R: IP: 10.0.0.1 R: IP: 10.0.0.2 R: IP: 10.0.0.3 But this is vanilla example, and in the real world we're dealing with the more complicated task. Remember, I noted keepalived? It needs dummy interfaces to be set up and keepalived.conf to be built. It means I need my variables both in bundle agend vrrp { vars: "net" string => "172.16.0"; "ip" ilist => { "1", "2", "3" }; "ip ilist => { "4", "5", "6" }; r1:: "my_id" string => "R1"; "his_id" string => "R2"; r2:: "my_id" string => "R2"; "his_id" string => "R1"; .... files: "/etc/sysconfig/network-scripts/ifcfg-dummy0:$(ip[$(my_id)])" ..... "/etc/keepalived.conf" edit_line => keepalived_cf("$(net)", "$(my_id)", "$(his_is)"), ..... } and in bundle edit_line keepalived_cf(net, my_id, his_id) { ... } Well, the iteration works as intended in the first bundle where it is declared, but it can't be used in the edit_line bundle because while $(arr[$(id)]) iteration works, the $(scope.arr[$(id)]) iteration doesn't. Working this thing around means a lot of duplicated vars or a lot of almost identical files in the configurations repository. Both workarounds cannot be called reasonably manageable. I really would like to see the iteration working. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine