On 02/06/2012 02:27 PM, Lisa Sittler wrote: > Say I have a defined classes which contains hosts which I simply name as > such: > > > > classes: > > "agents" or => { "agent01" , "agent02" , "agent03" }; > > "master" or => { "master01" }; > > > > Let's say I want to create a class which contains both classes: > > > > "agents_and_master" or => { "agent01" , "agent02" , > "agent03" , "master01" }; >
Instead of listing all the classes again I believe you could do "agent_or_master" or => {"agents", "master"}; > > Is there a way to create a class which contains multiple other classes? > > > > In this case I am only dealing with two classes, so I could use an OR > expression, when selecting the hosts I want, eg. > > > > files: > > agents|master:: > > > > But it seems to me that OR will not work with more than two choices and > in reality I want to merge more than two classes. I guess I could use > an AND in that case? > > > > files: > > > > agents.master.other:: This would require that agents, master, and other classes all be defined in order to apply the policy. That probably isn't what you wanted. You could do that with ors, I dont see why OR should not work with more than two choices. > But my question still stands. > > > > And I would like to do something fancier than naming all the hosts in a > class. Something like: > > > > "agents" expression => regcmp( "ag.*" , "${sys.host}"); > > > > but I have two hosts that would match that expression and I want to > exclude them. Let's say they are agent041 and agent042. In that case I think you would just want your regex to not match agent041 and agent042. you could also just exclude those agents when do the class matching for the promise too. agents.!(agent041|agent042):: I havent tested that, but I think it would work. -- Nick Anderson <n...@cmdln.org> _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine