pystachio icon indicating copy to clipboard operation
pystachio copied to clipboard

[Feature Request] Mustache Template iteration for List/Map

Open JustinVenus opened this issue 8 years ago • 1 comments

Would be nice to support iteration as documented in https://mustache.github.io/mustache.5.html

use case.

NAMERD_TEMPLATE = """---
admin:
  port: {{thermos.ports[admin]}}
storage:
  kind: io.l5d.zk
    experimental: true
    pathPrefix: /dtabs/{{profile.environment}}
  zkAddrs:
{{#region.zk}}
  - host: {{host}}
    port: {{port}}
{{/region.zk}}

Where region is:

class Region(Struct):
  zk            = Required(List(Map(String, String)))

Region(
    cluster='ZeroZero',
    zk = [
        {'host': 'zoo01', 'port': '2181'},
        {'host': 'zoo02', 'port': '2181'},
        {'host': 'zoo03', 'port': '2181'},
    ]
)

current result is:

aurora job create ZeroZero/nobody/devel/namerd namerd.aurora
Error loading configuration: #region.zk

JustinVenus avatar Oct 13 '16 20:10 JustinVenus

this looks more likely an issue with how you are using the pystachio schema for representing what your mustache template accepts, than with pystachio itself? at least I cannot see from this bug report how this is the right place to report it (or how to repro this problem).

dgoldstein0 avatar Apr 09 '19 00:04 dgoldstein0