Daniel Dehennin <daniel.dehen...@baby-gnu.org> writes:

> Could this be considered a regression on bug 135[1] or is there a better
> way to do it?

Sorry, my fault, I forgot that classes in "bundle agent" are not
globals.

Here is my new results:

#v+ bin/cf-agent -K -I
R: Bundle agent test evaluated
R: Bundle agent test2 evaluated
R: Bundle base PASS
R: Bundle common test PASS
R: Bundle agent test PASS
R: Bundle common test2 PASS
R: Bundle agent test2 PASS
#v-


Bundle names conflict between types (common, agent), so I prefix them
with a letter to distinguish them and reorder the bundlesequence:

#v+ promises.cf#v+

body common control
{
    bundlesequence => { @(Ctest.bundles), "Abase" };
    inputs => {"test.cf", @(Ctest.inputs) };
    version => "0.0.3";
}

bundle common Cbase
{
classes:

    "base" expression => "any";
}

bundle agent Abase
{
reports:

    base::
        "Bundle base PASS";

    !base::
        "Bundle base FAIL";

    test_common::
        "Bundle common test PASS";

    !test_common::
        "Bundle common test FAIL";

    test_agent::
        "Bundle agent test PASS";

    !test_agent::
        "Bundle agent test FAIL";

    test2_common::
        "Bundle common test2 PASS";

    !test2_common::
        "Bundle common test2 FAIL";

    test2_agent::
        "Bundle agent test2 PASS";

    !test2_agent::
        "Bundle agent test2 FAIL";

}

body classes if_ok(x)
{
    promise_repaired => { "$(x)" };
    promise_kept => { "$(x)" };
}

#v- test.cf
#v+
bundle common Ctest
{
vars:

    any::
        "bundles" slist => { "Atest", @(Ctest2.bundles) };
        "inputs" slist => { "test2.cf" };

classes:

    "test_common" expression => "any";
}

bundle agent Atest
{
files:

    "/tmp/test_agent"
        create    => "true",
        classes => if_ok("test_agent");

reports:

    base::
        "Bundle agent test evaluated";
}

#v- test2.cf
bundle common Ctest2
{
vars:

    any::
        "bundles" slist => { "Atest2" };

classes:

    "test2_common" expression => "any";
}

bundle agent Atest2
{
files:

    "/tmp/test2_agent"
        create    => "true",
        classes => if_ok("test2_agent");

reports:

    base::
        "Bundle agent test2 evaluated";
}
#v-

Regards.
-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

Attachment: pgpTZSJSFhews.pgp
Description: PGP signature

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

Reply via email to