Hello,

Iterations do not behave as expected for vars sections, in my opinion
at least, because vars section seems to be evaluated only once.

- The manual

cf3 Reference Manual explains (2. A simple crash course in concepts /
2.8 Normal ordering) :

"Within a bundle, the promise types are executed in a round-robin
fashion [...]. The actual sequence continues for up to three
iterations of the following:

        vars
        classes
        interfaces
        processes
        storage
        packages
        commands
        methods
        files
        reports"

- The test :

In the example below, I observe that vars promises are executed only once.
The promise "varnewclass", that depends on a user-defined class
evaluated in the same bundle, will not be held :

<code>

body common control
{
bundlesequence => { "test" };
}

bundle agent test
{
vars:
  any::
    "varany" string => "abc";
  newclass::
    "varnewclass" string => "def";

classes:
  any::
    "newclass" expression => strcmp("$(varany)", "abc");

reports:
  newclass::
    "newclass defined, varnewclass: $(varnewclass)";
}

</code>

The result is :
# cf-agent -Kf ./test-converge.cf
R: newclass defined, varnewclass: $(varnewclass)

The verbose option shows that only classes and reports sections are
iterated, not vars. Extract :
cf3    vars in bundle test (1)
cf3    classes in bundle test (1)
cf3    reports in bundle test (1)
cf3    classes in bundle test (2)
cf3    reports in bundle test (2)
cf3    classes in bundle test (3)
cf3    reports in bundle test (3)

>From my point of view, this tends to break the declarative approach in bundles.
Any convergent, or divergent, opinion among other users ?

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

Reply via email to