Skip to content

Instantly share code, notes, and snippets.

@jbd
Created August 23, 2012 14:49
Show Gist options
  • Save jbd/3437351 to your computer and use it in GitHub Desktop.
Save jbd/3437351 to your computer and use it in GitHub Desktop.
Iteration problem in cfengine
body common control
{
bundlesequence => { busers };
}
bundle agent busers
{
vars:
"musers[root][gecos]" string => "System administrator";
"musers[root][uid]" string => "0";
"musers[root][gid]" string => "0";
"musers[root][home]" string => "/root";
"musers[zamboni][gecos]" string => "Diego Zamboni";
"musers[zamboni][uid]" string => "501";
"musers[zamboni][gid]" string => "users";
"musers[zamboni][home]" string => "/home/zamboni";
"users_idx_1" slist => getindices("musers");
"users_idx_2[$(users_idx_1)]" slist => getindices("musers[$(users_idx_1)]");
reports:
linux::
"$(users_idx_2[$(users_idx_1)])";
}
## output
## # cf-agent -K -f ./reglist.cf
# R: $(users_idx_2[root])
# R: $(users_idx_2[zamboni])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment