Forum: CFEngine Help
Subject: Re: Explanation for 3x iteration in a bundle
Author: mark
Link to topic: https://cfengine.com/forum/read.php?3,24402,24421#msg-24421

I am a little late replying to this, but here is my take,

1. variables and classes are treated specially, due to the possibilty of 
circular dependences
2. All other promise types are handled by normal ordering

While CFEngine is parsing policy, it attempts to resolve and converge the 
values of variables and classes. Classes might be defined in terms of 
variables, variables only in certain classes, etc. So it takes a lot of work to 
resolve complex variable dependences. Because CFEngine automates this somewhat, 
it "looks as though" common classes get executed without being in the 
bundlesequence. However this is not the case -- it only looks that way because 
common bundles generally only contain variables and classes. 

Adding common bundles to the bundlesequence, gives the code another 3 chances 
to resolve hanging dependencies.

CFEngine then goes through the normal order promises, marking promises as 
"done", up to a maximum of three times, until all the promises have been marked 
"done". See for, example, 

http://source.cfengine.com/websvn/filedetails.php?repname=Cfengine+core&path=%2Ftrunk%2Fexamples%2Funit_ordering.cf

and play with to see if this helps. 

The Puppet guys claimed that they prescheduled a task graph (makespan) for a 
config run before executing, but this is actually not possible in a 
configuration system, because the very act of executing the configuration can 
change the system and the class-contexts on which the policy is based. To avoid 
the possibility of infinite loops, CFEngine has a cut off at 3 iterations. This 
is an arbitrary number based on empiricism. You can understand the algorithm as 
a self-healing/convergent execution tree with a halting safety-cutoff.

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

Reply via email to