I saw something I didn't expect last night. Ted cleaned up a sketch for 
managing /etc/security/limits.conf that worked like this example.

The file making the promise $(filename) gets set to different values 
based on a class. I thought due to normal ordering, on the first pass 
filename should get set to "/tmp/nodebug" since the debug class has not 
been raised yet. And then the files promise would create that file, but 
the only file created is "/tmp/debug" and it happens on the first pass.

I get more warnings about duplicate selection of value for variable 
"filename" if I move the !debug to any but the behaviour is still the 
same. Only /tmp/debug is created.

Can someone explain how the variable/class convergence works, and why 
this is the case?

https://gist.github.com/3217217

body common control {

     bundlesequence => { "main" };

     inputs => { "cfengine_stdlib.cf"};
}

bundle agent main {

methods:
   # yes|true|on as a parameter will raise the debug class
   "any" usebundle => test("on");

}

bundle agent test(param){
vars:
   debug::
     "filename" string => "/tmp/debug";

   !debug::
     "filename" string => "/tmp/nodebug";

classes:
   "debug" expression => regcmp("(?i)yes|true|on", "$(param)");

files:
   "$(filename)"
     create => "true",
     classes => if_repaired("repaired_$(filename)");

reports:
     cfengine::
         "I repaired $(filename)"
             ifvarclass => canonify("repaired_$(filename)");

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

Reply via email to