There are two ways to pass lists to functions in CFEngine (search for
"pass lists" in the reference manual): by parametrization, or by using
the fully qualified name of a list variable.

There is no mention of passing lists to bodies in the CFEngine
Reference Manual.  (Correct me if I'm mistaken.)  There is no
description of how to pass scalars vs how to pass lists.  Is there?

When I declare an external body part, I can declare a variable to
receive the parametrized value.  This variable, according to cf-agent
-v output, is always typed as a list. (Right?)  I am assuming that
because the -v output shows { } curly braces around the parameter that
is passed to the external body part and curly braces are only used in
lists, not in scalars.

So if the external body part's variables are typed as a list, why
doesn't passing a hard-coded list work?  This does not work:

{{{

bundle agent example {

files:

  "/tmp/test.txt"

     create => "true",
     edit_line => insert_lines({ "line one", "line two", "line three"
});  # this line bombs with:   syntax error, near token '{'

}

body common control {

  inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf" };

}

}}}

Why can I pass a list variable but not a list?

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

Reply via email to