1#+begin_src cfengine3 2body common control 3{ 4 bundlesequence => { run }; 5} 6 7bundle agent run 8{ 9 vars: 10 "todo" slist => { "call_1,a,b", "call_2,x,y", "call_2,p,q" }; 11 12 methods: 13 "call" usebundle => unpack($(todo)); 14} 15 16bundle agent unpack(list) 17{ 18 vars: 19 "split" slist => splitstring($(list), ",", "100"); 20 "method" string => nth("split", "0"); 21 "param1" string => nth("split", "1"); 22 "param2" string => nth("split", "2"); 23 24 methods: 25 "relay" usebundle => $(method)($(param1), $(param2)); 26} 27 28bundle agent call_1(p1, p2) 29{ 30 reports: 31 "$(this.bundle): called with parameters $(p1) and $(p2)"; 32} 33 34bundle agent call_2(p1, p2) 35{ 36 reports: 37 "$(this.bundle): called with parameters $(p1) and $(p2)"; 38} 39#+end_src 40