Forum: Cfengine Help
Subject: How can I merge several slist into one slist?
Author: random
Link to topic: https://cfengine.com/forum/read.php?3,21290,21290#msg-21290
I'm trying to use the code below to create a list of groups based on soft
classes I've set in promises.cf. Everything works for the most part except for
the "allowgroups_list" slist. The slists inside it are expanded if they're set
as expected. The issue I'm having is when I have a server that doesn't have
'database' class set, the allowgroups_list is expanded and the
@(allow_database) slist is added literally to the list instead of being
expanded into nothing. As a result, I get something like this when the
variable is expanded in the template:
AllowGroups
root,wheel,group1,group2,admin1,admin2,@(allow_database)
What is the correct way to accomplish this task with cfengine 3? I'd also be
interested to know if there's an easy way to remove duplicate names from the
slist.
Thanks
-random
bundle agent sshd_config {
vars:
web.external::
"allow_external" slist => { "group1", "group2" };
web.internal|web.backend::
"allow_internal" slist => { "admin1", "admin2" };
web.database::
"allow_database" slist => { "mysql", "admin1" };
web::
"defaultgroups" slist => { "root", "wheel" };
"allowgroups_list" slist => { @(defaultgroups), @(allow_external),
@(allow_internal), @(allow_database) };
"allowgroups" string => join(",","allowgroups_list");
files:
web::
"/etc/ssh/sshd_config"
comment => "Configure SSH",
perms => m("644"),
create => "true",
edit_line => expand_template("$(g.templates)/sshd_config.in"),
edit_defaults => empty;
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine