Thanks Mark, it makes sense. I ended up canonifying the index through an exec command. Not pretty but it works.
On Apr 11, 2009, at 3:41 AM, Mark Burgess <[email protected]> wrote: > > The problem here is almost certainly that the dot implies context and > the context should be the name of the bundle in which the array is > defined. So it is a reserved symbol. If you want to prefix, use the > underscore. > > Matt Richards wrote: >> 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 > > -- > Mark Burgess > > ------------------------------------------------- > Professor of Network and System Administration > Oslo University College, Norway > > Personal Web: http://www.iu.hio.no/~mark > Office Telf : +47 22453272 > ------------------------------------------------- _______________________________________________ Bug-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/bug-cfengine
