Forum: CFEngine Help
Subject: Re: Methods and default variables
Author: bbomgardner
Link to topic: https://cfengine.com/forum/read.php?3,23009,23011#msg-23011
I may be misunderstanding what you want to do, but perhaps you can assign
classes within foo using regcmp? That way if the value is missing there is no
error message. I tried this when I wanted to create all users at once using
the same bundle but have only some of them require specific passwords:
bundle agent create_users(user)
{
vars:
"index" slist => getindices("$(user)");
classes:
"add_$(index)" expression =>
islessthan(countlinesmatching("$(index):.*","/etc/passwd"), "1");
"enforce_pw_$(index)" expression =>
regcmp("yes|true","$($(user)[$(index)])");
"defaults_$(index)" expression =>
regcmp("yes|true","$($(user)[$(index)])");
...
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine