Hi Lisa !
>
>> 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?
> Why would it not work? OR is a logical operation, it would work on any number
> of classes:
>
> "some_class" or => { "agents", "master", "dns_server", "web_server",
> "suse_9" };
>
>
Which version of CFEngine are you using ? I remember we had some issues
on 3.1.4 with complex classes expression, that were not correctly
evaluated, so it could explain why you believe that you can OR more than
twice
>> 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.
> You could do this like Nick suggested, by explicitly excluding them, with
> something like this:
>
> "agents" expression => and(regcmp( "ag.*", "$(sys.host)" ),
> not("agent041"), not("agent042"));
>
>
You could also use class conditions to define classes :
classes:
!agent041.!agent042::
"agents" expression => regcmp( "ag.*" , "${sys.host}");
Or even a bit more complex with classes and ifvarclass:
classes:
!agent041.!agent042::
"agents"
expression => regcmp( "ag.*" , "${sys.host}"),
ifvarclass => "some_class_expression";
Best regards !
Nicolas
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine