Another odd bug. It would appear that readstring array has some issues
with a "." within the first dimension of the array. Consider the
following example:
# cat /tmp/hosts
host_a.domain.com:f2:f3
host_a_domain_com:f2:f3
# cat test.cf
###
body common control {
bundlesequence => { "test" };
}
###
bundle agent test {
vars:
"array" int =>
readstringarray("hosts","/tmp/hosts","#[^\n]*",":",1000,40000);
"indices" slist => getindices("hosts");
reports:
Yr2009::
"indices : $(indices)";
"dot_notation field 2 : $(hosts[host_a.domain.com][2])";
"canon_notation field 2 : $(hosts[host_a_domain_com][2])";
}
# cf-agent -Kf test.cf
R: indices : host_a.domain.com
R: indices : host_a_domain_com
R: dot_notation field 2 : $(hosts[host_a.domain.com][2])
R: canon_notation field 2 : f3
The indices look correct, however if accessing the array (see
dot_notation above) using a "." in the indice, it does not seem to
work.
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine