On Thu, Sep 16, 2010 at 12:41 AM, <no-re...@cfengine.com> wrote: > Forum: Cfengine Help > Subject: Re: Cfengine Help: Looking for ideas on people's config > Author: hhammer > Link to topic: https://cfengine.com/forum/read.php?3,18246,18258#msg-18258 > > Thanks. So in this example: > > ---- > "common_seq" slist => { "some", "common", "bundles" }; > > web_servers:: > "site_seq" slist => { @(common_seq), "php", "apache2" } ; > > data_servers:: > "site_seq" slist => { @(common_seq), "mysql" } ; > > processing_servers:: > "site_seq" slist => { @(common_seq), "some_engine" } ; > ---- > > How does one compose a site_seq list for hosts that are web_servers and > data_servers? Is adding a final line like > > web_servers.data_servers:: > "site_seq" slist => { @(common_seq), "php", "apache2", "mysql" } ; > > the only way? Or can we do something like > > ---- > "site_seq" slist => { "some", "common", "bundles" }; > > web_servers:: > "site_seq" slist => { @(site_seq), "php", "apache2" } ; > > data_servers:: > "site_seq" slist => { @(site_seq), "mysql" } ; > > processing_servers:: > "site_seq" slist => { @(site_seq), "some_engine" } ; > ---- > > That would be cool, but cfengine doesn't seem to like it. >
Wow you hit the nail on the head very quickly. I my opinion the inability to extend an slist is cfengine greatest current weakness, one that undermines it greatest strength (class based convergence). I think the notion of convergence is great for my system state - not so great for variable resolution. The solution I have had to construct every time I run into this issue is to introduce another variable to handle the extra dimension, e.g.L ---- "common_seq" slist => { "some", "common", "bundles" }; "extra_seq" slist => { } ; web_servers:: "locl_seq" slist => { "php", "apache2" } ; data_servers:: "locl_seq" slist => { "mysql" } ; processing_servers:: "locl_seq" slist => { "some_engine" } ; data_servers.processing_servers:: "extra_seq" slist => { "something_else" } ; ---- and then: "site_seq" slist => { @(common_seq), @(locl_seq), @(extra_seq) } ; Actually even the above convolutions don't work (because you cant have an empty slist) - and every time you introduce a new dimension you need to introduce a new variable to cater for it. Sometimes I get sick of this, and just start repeating sections of code, e.g.: data_servers.processing_servers.SomeOtherDimension:: "extra_seq" slist => { "something_else", "some_other_bundle" } ; # because I could not do: "extra_seq" slist => { @{extra_seq}, "some_other_bundle" } ; The problem with the above is I have now had to write in two places that 'data_servers.processing_servers' include "something_else". Have fun! > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine >
_______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine