I just noticed this, and I am not sure what i am doing wrong.

I cant seem to loop over a globally referenced slist, I am however able
to pass the list to a bundle and then iterate over the local variable
reference. What am I not understanding?

R: In bundle agent report_list
R: List 1: list1v1
R: List 1: list1v2
R: List 1: list1v3
R: In bundle agent main
R: String 1: string value 1
R: String 2: string value 2
R: List 1: $(site.list1)

-- 
Nick Anderson <n...@cmdln.org>
body common control {

    bundlesequence => {
                        "site",
                        "main",
                       };

    inputs => {
                "cfengine_stdlib.cf",
                };

}

bundle common site {

vars:
    "string1" string => "string value 1";
    "string2" string => "string value 2";

    "list1"   slist  => { "list1v1", "list1v2", "list1v3" };
}

bundle agent main {
    methods:
        "any" usebundle => report_list("@(site.list1)"),
            comment => "If I pass the globablly referenced slist to a bundle I
                        can loop over the list items with a local reference 
                        without issue";

    reports:
        cfengine::
            "In bundle agent main";
            "String 1: $(site.string1)";
            "String 2: $(site.string2)";
            "List 1: $(site.list1)",
                comment => "This does not do implicit looping";


}

bundle agent report_list(v){
    reports:
        cfengine::
            "In bundle agent report_list";
            "List 1: $(v)",
                comment => "Implicit looping over local variable works fine";

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

Reply via email to