[openstack-dev] [heat][yaql] Deep merge map of lists?
therve at redhat.com
Mon Aug 29 05:07:09 UTC 2016
On Sun, Aug 28, 2016 at 11:58 PM, Steven Hardy <shardy at redhat.com> wrote:
> Hi all,
> I have a need to merge a list of maps of lists:
> heat_template_version: 2016-10-14
> # dict(vms=>dict($.vms.select([$.name, $])))
> expression: dict($.data.l.select([$.keys().toList(),
> - a: 
> - b: 
> - a: 
> I want to end up with debug as:
> a: [123, 456]
> b: 
> Perhaps we need a map_deep_merge function, but can this be done with yaql?
> I suspect it can, but can't currently figure out how the assignment to the
> intermediate "a" value is supposed to work, any ideas on the cleanest
> approach appreciated!
I believe you don't need the intermediate value, and can rely on what
you'd do in Python with setdefault:
ought to work, I believe?
More information about the OpenStack-dev