Hello, me again ;-) I try to pass an array as bundle parameter without success, the following promise reports:
#v+
R: line is $($(line)[$(idx)])
#v-
Seems to work for others[1].
#v+
body common control
{
bundlesequence => { "filetest" };
version => "0.0.2";
}
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)";
files:
"/tmp/someapp.conf"
create => "true",
edit_line => insert_array_lines("$(line)"),
edit_defaults => empty,
comment => "Configuration for someapp";
}
bundle edit_line insert_array_lines(v)
{
vars:
"idx" slist => getindices("$(v)");
insert_lines:
"$($(v)[$(idx)])"
comment => "Expand variables in the template line",
expand_scalars => "true";
reports:
Yr2010::
"line is $($(v)[$(idx)])";
}
body edit_defaults empty
{
empty_file_before_editing => "true";
edit_backup => "false";
max_file_size => "300000";
}
#v-
Regards.
Footnotes:
[1] like in
http://blog.zzamboni.org/editing-sshd-configuration-files-with-cfengin?c=1
--
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
pgpRMLOtS319q.pgp
Description: PGP signature
_______________________________________________ Help-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/help-cfengine
