I'd rather rewrote it as follows:
classes:
'PBS_reg' expression => regcmp(".*r[0-9]+n[0-9].*");
'PBS_ok' not => classify("gb-r7n1.irc.sara.nl");
'PBS_MOM' and => { "PBS_ok", "PBS_reg", "${sys.host}" };
2011/6/17 Jesse Becker <[email protected]>:
> On Fri, Jun 17, 2011 at 05:25:44AM -0400, Bas van der Vlies wrote:
>>I want to define a classs like this:
>> classes:
>> "PBS_MOM" and => { !classify("gb-r7n1.irc.sara.nl"), regcmp(
>>".*r[0-9]+n[0-9].*", "$(sys.host)" ) };
>>
>>This is not a valid syntax. Is it possible to set a class and use the 'not'
>>operator? For me it would be useful or are there other ways to accomplish
>>this?
>>
>>PS) I used this syntax a lot in cf2 to define classes.
>
> I had to do something similar, and I think that I wound up breaking it
> into what I consider "interstitial classes" (i.e. classes that aren't
> used for anything other than constructing other classes, in order to get
> around syntax limitations).
>
> In your example, I think that this would achive what you want (untested):
>
> classes:
> 'PBS_dom' expression => classify("gb-r7n1.irc.sara.nl");
> 'PBS_reg' expression => regcmp(".*r[0-9]+n[0-9].*");
> 'PBS_MOM' expression => "!PBS_dom.PBS_reg.${sys.host}"
>
> Of course, the ability to nest the various and{}, or{}, not{}, xor{}
> expressions would be nice.
>
> Alternately, implement a "not()" function, independent of the "not{}"
> classes construct.
>
>
>
> --
> Jesse Becker
> NHGRI Linux support (Digicon Contractor)
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
--
SY, Seva Gluschenko.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine