Forum: Cfengine Help
Subject: Re: Array as bundle parameter
Author: phnakarin
Link to topic: https://cfengine.com/forum/read.php?3,19779,19781#msg-19781
May I do something like this following?
bundle agent filetest
{
vars:
any::
"line[0]" string =>
"line1
line2 with $(const.dollar)(sys.host): $(sys.host)";
"line[1]" string => "line3 with undefined variable: $(notdefined)";
"number" slist => getindices("line");
files:
"/tmp/someapp.conf"
create => "true",
edit_line => insert_array_lines("$(line[$(number)])"),
edit_defaults => empty,
comment => "Configuration for someapp";
}
bundle edit_line insert_array_lines(v)
{
insert_lines:
"$(v)"
comment => "Expand variables in the template line",
expand_scalars => "true";
reports:
Yr2010::
"line is $(v)";
}
Cheers,
--Nakarin
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine