Forum: CFEngine Help
Subject: Re: Passing parameters to methods bundle
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,26825,26827#msg-26827

cf-promises seems be evaluating product before the parameters are passed. 
Without passing, product works as expected.

$ cat foo.cf 
body common control {
        bundlesequence => { "main" };
}

bundle agent main {
        methods:
        "any" usebundle => test("10","15");
}

bundle agent test(num1,num2) {
        vars:
        #"list1" rlist => { "$(num1)", "100" };
        "list1" rlist => { "10", "100" };
        #"list2" rlist => { "$(num2)", "100" };
        "list2" rlist => { "15", "100" };

        "x" real => product("list1");
        "y" real => product("list2");

        reports:
        cfengine_3::
        "x = $(x)";
        "y = $(y)";
}
$ cf-agent -IKf ./foo.cf 
R: x = 1000.000000
R: y = 1500.000000
 !! Method invoked repairs


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

Reply via email to