On Tue, Jun 07, 2011 at 11:14:16AM -0400, no-re...@cfengine.com wrote:
>Forum: Cfengine Help
>Subject: Class exception.
>Author: chadpatt
>Link to topic: https://cfengine.com/forum/read.php?3,22379,22379#msg-22379
>
>This might be confusing but here it goes.
>
>I have a list of servers defined by group classes.  I have some db servers 
>that are in the main group "all" but in a sub group "database".  What I want 
>to do is have my class so that "all" servers get a promise except for 
>"database".
>
>would that look like?
>all|!database::   OR something else.   The reason I need this is there are 
>hundreds of classes inside all and I want to just weed out database.

You can combine boolean operators.  Cfengine supports a syntax that
combines logical AND, OR, NOT, and grouping constructs.  It also
supports "and", "or", "not", and "xor" expressions for defining new
classes.

In your example, I think you want to do soemthing like this:

bundle agent foo {

classes:
        'all'       or => { 'a', 'b', 'c' };
        'databases' or => { 'c' };

reports:
        
        all: 
                "Host ${sys.fqhost} is in 'all' class.";

        all.!databases::
                "Host ${sys.fqhost} is in 'all' class, but not in 'databases'.";
}


This, while untested, should print two reports each for hosts 'a' and
'b', but only one report for host 'c'.


See these for reference:

http://www.cfengine.org/manuals/cf3-reference.html#Class-combination-operators-and-precedence
http://www.cfengine.org/manuals/cf3-reference.html#classes-in-common-promises


-- 
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to