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

Hi-

I'm putting together a presentation about cfengine and noted that cf-agent will 
loop up to three times within a bundle as it converges on the final state.  I 
then realized that I don't have a good feel for what that really means.  The 
reference manual simply says:

Within a bundle, the promise types are executed in a round-robin fashion 
according to so-called `normal ordering' (essentially deletion first, followed 
by creation). The actual sequence continues for up to three iterations of the 
following, converging towards a final state

This doesn't seem to mean that cf3 will actually re-run through the bundle in a 
linear fashion, carrying with it any class changes.  Take this bundle as an 
example:


bundle agent test {

vars:

        "myslist"  slist => { "red", "green", "blue" };
   
  red::
        "redvar" string => "redvar";


files:

        "/tmp/foo/$(myslist)"
                copy_from => local_cp("/root/$(myslist)"),
                classes => if_repaired("$(myslist)");

reports:
        red::
        "$(redvar) is true.";
}




Verbose output shows that cf-agent does generate a "reports:" section for the 
test bundle three times but the $(redvar) variable is never set.  

The class is activated upon file copy:


cf3>  -> Updated file from localhost:/root/red
cf3>  ?> defining promise result class red



greping saved output from the same execution shows that the variable is never 
set despite cf-agent allegedly passing back through "vars in bundle test" two 
more times.


# grep redvar /tmp/cf
cf3> Skipping whole next promise (redvar), as context red is not relevant
cf3>     Promise made by: $(redvar) is true.
cf3> Report: $(redvar) is true.
cf3> R: $(redvar) is true.


Could someone kindly elaborate on what this iterative execution really means?

Thanks in advance.

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

Reply via email to