Will- There is another way to do this (although Mark is certainly correct in what he says), and that is to do the management of the differences outside of Cfengine:
1) Create two subdirectories: $(masterfiles)/everyone and $(masterfiles)/special_everyone 2) Populate both those directories with ALL the files either everyone or special_everyone needs. This means that if there are files that appear in both subtrees, you have to either have to use hard links to maintain identical copies (or sylinks, and get more complicated), or have different versions in each tree. 3) Copy either (but not both) directory into your /usr/local/everyone (using the classes "IsSpecial" or "!IsSpecial" to get only one copy). Because you have two complete source directories, you can now use "purge" without worries. There is often a great temptation to put EVERYTHING into the control of Cfengine, and this is not always the best route. For example, using svn or such like is often a better way to maintain versioning information. Having Cfengine USE that information might be better than trying to do complex versioning directly in Cfengine. Using cfengine's logrotate and transformer features are best if you have a heterogenous environment, but if you have a completely homogenous environment, using the OS's logrotate feature (and using Cfengine to maintain /etc/logrotate.conf) might be better. The trick is to think about using Cfengine first, and then also ask "am I making this too complicated?". In general, if you find yourself unable to do something neatly, or if you find Cfengine fighting you (like you did in your example), then maybe your approach is too complicated or, as Mark pointed out, not convergent... -Dan On Aug 3, 2010, at 11:54 PM, Mark Burgess wrote: > > Will, what you are trying to do is not a convergent operation and I strongly > advise > against it. (Merging 2 sets cannot be convergent because if the sets overlap, > the outcome > is unclear). Purging only adds to the confusion. It's like getting two teams > to paint > your house and telling one "paint it red" and the other "paint it white" -- > then "off you > go and let me now when your're done". There is no desired end state. > > I would copy the files without purging and periodically delete everything if > you want to > clean up. That is the only reliable way. I would also avoid trying to merge > things unless > you know that files can never overlap. > > Will Nowak wrote: >> i All, >> >> I've been toying around with CFengine a bit, and have run into a bit >> of a wall. I've got a bunch of machines that all need a certain set of >> files copied to /usr/local/everyone. On some of the machines, there >> are other special files that go in /usr/local/everyone that lay on top >> of the generic set of files. What I currently do is run two copy >> actions -- once as a general rule that applies to all machines, and >> another for specific special machines. This is well and good, >> everything gets copied. However, if we enable purge on the overlay >> set, it deletes all the files from the base set each copy run. Most of >> the time all the files are there, but during a copy run, the base set >> briefly disappear. >> >> Is there a way to do a copy operation and let CFengine know that it is >> a merge of two source directories? >> >> # Base set of files >> copy: >> any:: >> $(masterfiles)/everyone/ dest=/usr/local/everyone/ >> server=$(policyhost) >> recurse=inf >> backup=false >> >> # Special set of files >> classes: >> isSpecial = ( >> special_hosts >> ) >> copy: >> isSpecial:: >> $(masterfiles)/special_everyone/ >> dest=/usr/local/everyone/ >> server=$(policyhost) >> backup=false >> purge=true >> recurse=inf >> >> >> Thanks! >> -Will >> _______________________________________________ >> Help-cfengine mailing list >> Help-cfengine@cfengine.org >> https://cfengine.org/mailman/listinfo/help-cfengine > > -- > Mark Burgess > > ------------------------------------------------- > Professor of Network and System Administration > Oslo University College, Norway > > Personal Web: http://www.iu.hio.no/~mark > Office Telf : +47 22453272 > ------------------------------------------------- > _______________________________________________ > 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