Hi Diego, thanks for response.

On Wednesday 04 January 2012 17:37:03 Diego Zamboni wrote:
> To unconditionally undefined a class (which is what -N does) you could
> define it as an expression that always evaluates to false:
> 
> classes:
>   "class_to_undefine"  not => "any";

I tried that, both with custom classes and cfengine-defined classes but it 
doesn't work.

> To negate an existing class (not necessarily undefining it), I don't think
> you can do it on top of the same class, but you can certainly define a new
> class with the negated value:
> 
> classes:
>   "negated_class" not => "original_class";
> 
> or
> 
> classes:
>   "negated_class" expression => "!original_class";

Tried both of those as well.  Maybe it's a bug?  (if it's supposed to work)

I do need to undefine/negate a cfengine-set class (have_aptitude, set in 
sysinfo.c).  I have:

$ cat test-cls-override.cf
body common control {
  bundlesequence => { "report" };
}

bundle common g {
  classes:
    "have_aptitude" not => "any";
    "foo" expression => "any";
}

bundle agent report {
  classes:
    "foo" not => "any";

  reports:
    have_aptitude::
      "have aptitude";
    !have_aptitude::
      "do not have aptitude";
    foo::
      "have foo";
    !foo::
      "do not have foo";
}

$ sudo cf-agent -f ./test-cls-override.cf -I
R: have aptitude
R: have foo

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  
It is intended solely for the addressee and access to the email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail 
are subject to the terms and conditions expressed  in the governing client 
engagement leter or contract.
If you have received this email in error please notify 
supp...@henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, 
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************

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

Reply via email to