Marc Baudoin <baud...@stg-interactive.com> écrit : > > As the number of different types of hosts in my configuration > grows, I wonder what are the strategies for making bundlesequence > and inputs more modular. > > I define a class for each type of hosts so, of course, there's > the class approach: > > body common control > { > class1:: > > bundlesequence => { "common" , "specific1"} ; > inputs => { "common.cf" , "specific1.cf" } ; > > class2:: > > bundlesequence => { "common" , "specific2"} ; > inputs => { "common.cf" , "specific2.cf" } ; > } > > But what if a client belongs both to class1 and class2? > > My main goal is to avoid redundancies. The common parts of > bundlesequence and inputs can go into an slist, that's fine. > > I tried to define another slist variable to handle the specific > parts of bundlesequence and inputs. My idea was to begin vith an > empty slist (now that we can use "cf_null") and then add bundles > and inputs for each class the client belongs to. But it's not > possible to use the slist as in: > > "specific" slist => { @(specific) , "other_stuff" } ; > > and I found no way to add elements to an existing slist. > > So I'm stuck here with no elegant solution to my problem. > > How do people with a non-trivial configuration deal with this?
Thank you to Daniel V. Klein, Michael Potter and Bas van der Vlies for their replies. I went for this approach: promises.cf: ----------------------------------------------------------------- body common control { bundlesequence => { @(g.bundlesequence) , } ; ignore_missing_inputs => "true" ; inputs => { "cfengine_stdlib.cf" , "common.cf" , @(g.inputs) , } ; } ----------------------------------------------------------------- common.cf: ----------------------------------------------------------------- bundle common g { classes: # definition of classes vars: dns:: "bundlesequence_dns" comment => "bundlesequence for DNS servers" , slist => { "dns" , } ; "inputs_dns" comment => "inputs for DNS servers" , slist => { "dns.cf" , } ; # add more classes here any:: "bundlesequence" comment => "bundlesequence" , policy => "ifdefined" , slist => { "common_bundlesequences" , @(bundlesequence_dns) , # add more here } ; "inputs" comment => "inputs" , policy => "ifdefined" , slist => { "common_inputs.cf" , @(inputs_dns) , # add more here } ; } ----------------------------------------------------------------- -- Marc Baudoin STG Interactive _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine