aequitas / concourse-http-api-resource

Concourse resource to allow interaction with (simple) HTTP API's.
https://hub.docker.com/r/aequitas/http-api-resource/
MIT License
25 stars 18 forks source link

Recursive variable interpolation needs a case for lists #2

Closed ericroy closed 6 years ago

ericroy commented 8 years ago

Currently, recursive string interpolation doesn't recurse into lists. It should be pretty easy to add a case to handle this here: https://github.com/aequitas/concourse-http-api-resource/blob/master/assets/resource.py#L103

eg:

for k, v in data.items():
    if isinstance(k, str):
        k = k.format(**values)
    if isinstance(v, str):
        v = v.format(**values)
    elif isinstance(v, dict):
        v = self._interpolate(v, values)
    elif isinstance(v, list):
        v = [self._interpolate(o, values) for o in v]
aequitas commented 6 years ago

sorry for the late reply, fixed in next release.