Hi.  I am in communication with a CFEngine 2 site that would like to
move to CFEngine 3, but the ability to specify the lists of inputs and
bundlesequence is a potential showstopper.


I pointed them to Neil's
http://watson-wilson.ca/2011/09/dynamic-bundlesequence-in-cfengine.html
but it does not work if the classes are specified within the common
bundle (i.e. instead of specifying -Dcf_dbs on the command line, the
policy contains a promise to define "cf_dbs" inline:

    classes:
        "cf_dbs"
            expression => "linux";

)


cf-agent then complains:

    Scalar variable "bseq" contains itself (non-convergent): @{bseq}
    Variable "bseq" contains itself indirectly - an unkeepable promise


Here is the complete self-contained example (it's just Neil's example
plus the classes promise above):

--start quote--

bundle common g {

    classes:
        "cf_dbs"
            expression => "linux";

    vars:

        any::

            "bseq" slist => {
                "site",
                "ntp",
                "hard"
            },
            policy => "free";

        cf_dbs::

            "bseq" slist => {
                @{bseq},
                "db2",
                "mysql"
            },
            policy => "free";

        cf_webfarm::

            "bseq" slist => {
                @{bseq},
                "httpd",
                "proxy"
            },
            policy => "free";
}

body common control {

    bundlesequence => { "@{g.bseq}" };

}

bundle agent site{
    reports:
        cfengine_3::
            "site bundle";
}
bundle agent ntp{
    reports:
        cfengine_3::
            "ntp bundle";
}
bundle agent hard{
    reports:
        cfengine_3::
            "hard bundle";
}
bundle agent db2{
    reports:
        cfengine_3::
            "db2 bundle";
}
bundle agent mysql{
    reports:
        cfengine_3::
            "mysql bundle";
}
bundle agent httpd{
        reports:
            cfengine_3::
                "httpd bundle";
}
bundle agent proxy{
        reports:
            cfengine_3::
                "proxy bundle";
}
--end quote--

Why does Neil's example work with -Dcf_dbs but does not work when the
class is defined in the promise file?  (If I remove the classes
promise, the code runs under cf-agent just fine.)

So - is it possible to have a dynamic bundlesequence when there are
custom classes in play?  If so, how?

Yours truly,
-at
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to