I cant seem to get the syntax right for accessing a list stored in an array.

I define users and groups using arrays, I would like to be able to use
the same style when defining group members.

then pass groups to a parameterized bundle to make sure the list of
members for that group get added to /etc/group.

bundle agent main {
vars:
"groups[specialadmins][gid]" string => "1000";
"groups[specialadmins][members]" slist => { "bill", "ted" };

methods:
"specialadmins" usebundle => add_group_members_locally("main.groups");
}

bundle agent add_group_members_locally(groups) {
vars:
"groupfile" string => "/tmp/group";
"groupindex" slist => getindices("$(groups)");

files:
   linux::
        "$(groupfile)"
            edit_line   =>
append_user_field("$(groupindex)","4","@(groups[$(groupindex)][members])";

}

I can get it to expand out to groups[specialadmins][members] but not the
slist stored there, I am sure I am mis understanding some concept here,
can someone enlighten me?

-- 
Nick Anderson <n...@cmdln.org>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to