cfengine/design-center — pull request #377 by bheilman (2013-09-27 00:24:01+00:00)
Title: fix off by one error

fix off by one error

example:

"sudoers_wheezy" : {
"System::Sudoers" : {
"cmnd_alias" : {},
"defaults" : [
{
"default_desc" : "Defaults",
"default_value" : "mail_badpass"
},
{
"default_desc" : "Defaults",
"default_value" : "env_reset"
},
{
"default_desc" : "Defaults",
"default_value" : "secure_path=\\\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\""
},
{
"default_desc" : "Defaults",
"default_value" : "env_keep+=SSH_AUTH_SOCK"
}
],
"file_path" : "/etc/sudoers",
"host_alias" : {},
"runas_alias" : {},
"user_alias" : {},
"user_permissions" : {
"#includedir" : "/etc/sudoers.d",
"%sudo" : "ALL=(ALL) NOPASSWD: ALL",
"root" : "ALL=(ALL) ALL"
},
"visudo_path" : "/usr/sbin/visudo"
}
},

Creates

# array 'defaults' from definition sudoers_wheezy, activation __sudoers_wheezy_sandbox_005_System_Sudoers_ensure
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000000][default_desc]" string => "Defaults";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000000][default_value]" string => "mail_badpass";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000001][default_desc]" string => "Defaults";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000001][default_value]" string => "env_reset";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000002][default_desc]" string => "Defaults";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000002][default_value]" string => "secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000003][default_desc]" string => "Defaults";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000003][default_value]" string => "env_keep+=SSH_AUTH_SOCK";
"__sudoers_wheezy_sandbox_005_System_Sudoers_ensure_defaults[000004]" string => "";