Bas van der Vlies writes:
{{#bidirectional_rules_interfaces}} allow from {{@.source}} to any port {{{@.service}}} in {{{@}}} allow from {{cua_admin_interface.source}} to any port {{{cua_admin_interface.service}}} in {{{@}}} {{/bidirectional_rules_interfaces}} the second line works because if specify the interface name, but the first does not expand. Is there a feature that allows dynamic keyword expansion? I would be very useful for a lot of templates.
Hi Bas,
Does this work for you?
bundle agent main { vars: "d" data => '{ "bidirectional_rules_interfaces": { "cua_admin_interface":{ "service": "cfengine", "source": "admin-lan-grp" }, "cua_admin_interface2":{ "service": "cfengine2", "source": "admin-lan-grp2" }}}'; reports: "$(with)" with => string_mustache( "Iterating over dict of dicts:$(const.n){{#bidirectional_rules_interfaces}} Interface = {{@}}, source = {{.source}}$(const.n){{/bidirectional_rules_interfaces}}", d ); }
R: Iterating over dict of dicts: Interface = cua_admin_interface, source = admin-lan-grp Interface = cua_admin_interface2, source = admin-lan-grp2
On 12 Nov 2020, at 18:58, 'Nick Anderson' via
So, you added a comment line and it worked?Smells fishy.
Yes that was what I also thought
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/b963e764-3707-49d7-a2b7-0279532ca71cn%40googlegroups.com.