Hi Nick,

I haven't fully worked through the reason, but I'm pretty sure the problem lies 
with the not(), because the not() function returns a string, which is then 
being classify-ed - so the "!" inserted by the not() would be lost.

Attached is an example that works - it precomputes the canonified class names, 
and then just uses those in the expressions:

$ cf-agent -KI -f ./class_when_thing1_but_not_thing2.cf -Dtail
R: Hat: true
R: Tail: true
$ cf-agent -KI -f ./class_when_thing1_but_not_thing2.cf 
R: Hat: true
R: Tail: false
R: I have a cat in a hat with no tail

This can probably be simplified further to avoid so many temporary variables.

--Diego

Attachment: class_when_thing1_but_not_thing2.cf
Description: Binary data


On Sep 7, 2012, at 1:29 PM, Nick Anderson <n...@cmdln.org> wrote:

> On 09/07/2012 01:17 PM, Diego Zamboni wrote:
>> On a quick look, I think you need to put the not() outside classify()
>> and not inside. Not tested.
> 
> I tried that, but not() returns type string.
> 
> cf3> ./class_when_thing1_but_not_thing2.cf:38,35: function not() returns type 
> string but lhs requires clist, near token '}'
> cf3> ./class_when_thing1_but_not_thing2.cf:38,35: function not() returns type 
> string but lhs requires clist, near token '}'
> 
> I also tried replacing the not() with ! inside the string, that didnt work 
> either, it just reversed the problem and instead of always raising the 
> redfish class it never raises it.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to