https://gist.github.com/3667439

I am having issues getting a class to raise when one class is present 
and another is not. It must be something simple I am overlooking.

The area in question is around the redfish class in this example.

I expect to be able to set cat_tail to something other than true and 
have the report printed. Set cat_tail to true and it should not be 
printed. What I get is the report printed all of the time.


body common control {

     inputs => { "../sketches/CFEngine/stdlib/cfengine_stdlib.cf" };
     bundlesequence => { "main" };


}

bundle agent main
{
vars:
   "cat_hat" string => "true";
   "cat_tail" string => "true";


methods:
   "story time" usebundle => test("main.cat_");

}

bundle agent test(prefix)
{
vars:
   "bundle" string => "test";
   "class_prefix" string => "$(prefix)$(bundle)_";

classes:
   "$(class_prefix)thing1" expression => regcmp("true", "$($(prefix)hat)");
   "$(class_prefix)thing2" expression => regcmp("true", "$($(prefix)tail)");


   # Define redfish when thing one but not thing 2
   # Notice that class_prefix contains illegal characters (the dot in 
main.cat_)
   # So when testing the existance of the classes must be careful to
   # classify/canonify the strings
   "$(class_prefix)redfish" and => { classify("$(class_prefix)thing1"),
                                     classify(not("$(class_prefix)thing2"))
                                   };

reports:
   cfengine::
     "I have a cat in a hat with no tail",
       ifvarclass => canonify("$(class_prefix)redfish");

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

Reply via email to