Affects Version/s: None
Fix Version/s: None
Found in version (details):3.12.1
The handling of iteration over objects vs. lists in mustache templates is a little bit inconsistent/unpredictable (or at least cannot be predicted from the documentation).
Here is a test that doesn't work at all:
This produces the error:
Whatever that means.
Removing these lines allows the template to at least render (although they shouldn't need to be removed):
Then it produces these results:
1. A data container (object) cannot be iterated over solely by value, whereas a list can be. This is a bug. (To include the values from an object in the rendered file, you MUST include the keys.) This is the test that throws the error above and doesn't render at all.
2. A data container that is iterated over without any reference to the keys, will produce only ONE line in the rendered output. Contrast this with the handling for a list, where iterating over a list without referring to the values (using the "." variable) will still produce as many lines (blocks) as there are elements in the list. This is a bug.
I haven't tested the handling for CFEngine slists and classic arrays that are passed by top-level key, but I anticipate that these same bugs will hold true. (Also see CFE-3124 for an additional bug about CFEngine classic arrays.)