Forum: CFEngine Help
Subject: Re: How to add to line with field_edits?
Author: bbomgardner
Link to topic: https://cfengine.com/forum/read.php?3,22981,23002#msg-23002
Field edits are meant to be a small atomic changes, one sub-value should be
checked/added/deleted at a time. The idea being that any sub-field is
independent of another. When you want all members of an array to be treated as
one single change it is better to have them as a one single string.
Here is a simpler option that may work for you. Start with Diego's example and
join your list together as one string:
bundle agent test
{
vars:
"serverlist" slist => { "server1", "server2", "server3" };
"config" string => join(" ","serverlist");
files:
"/foo/bar"
create => "false",
edit_line => set_config_values("config");
}
You could also setup an edit_line to delete any line that looks incorrect and
insert the line you want.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine