Forum: CFEngine Help
Subject: Dynamic inputs and maplist function
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,26595,26595#msg-26595

I'm attempting to have definable inputs to allow for privacy.  Consider this 
example.

bundle common foo {

        vars:
                "l" slist => { "a.cf", "b.cf", "c.cf" };
                "cl" slist => maplist("${sys.workdir}/dir/$(this)", "l");

        reports:
                cfengine::
                        "cl => ${cl}";
}
body common control {
        #ignore_missing_inputs => "true";
        bundlesequence => { "foo", "main", };
        foo::
                inputs => { "@{foo.l}", };
        bar::
                inputs => { "@{foo.cl}", };
}

bundle agent main {

        methods:
                "any" usebundle => test;
}

bundle agent test {

        reports:
                cfengine::
                        "test";
}

# cf-promises -f ./inputs.cf -D foo
Can't stat file "./a.cf" for parsing
 !!! System reports error for stat: "No such file or directory"

# cf-promises -f ./inputs.cf -D bar
Can't stat file "./@{foo.cl}" for parsing
 !!! System reports error for stat: "No such file or directory"


Notice that the normal (l) list's contents is expanded into inputs. Meanwhile 
the list (cl) created via maplist is not expanded. Have I done something wrong?

On the subject of maplist be aware of this bug:
https://cfengine.com/bugtracker/view.php?id=1249

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

Reply via email to