[openstack-dev] [heat][yaql] Heat map replacement options

Peter Razumovsky prazumovsky at mirantis.com
Fri Jul 15 12:35:51 UTC 2016


Try this:

yaql:
  expression:let(root => $) ->
dict($root.data.service.items().select([$[0], $root.data.ip[$[1]]]))
  data:
    service: { get_param: ServiceNetMap }
    ip: { get_param: NetIpMap}


2016-07-15 12:25 GMT+03:00 Steven Hardy <shardy at redhat.com>:

> Hi all,
>
> I'm trying to figure out the cleanest way to do a replacement of values in
> a mapping (json parameter) in a heat template, e.g:
>
>   ServiceNetMap:
>     type: json
>     default:
>       IronicApiNetwork: internal_api
>       CephPublicNetwork: storage
>
>   NetIpMap:
>     type: json
>     default:
>       storage: 192.0.2.2
>       internal_api: 192.0.2.5
>
> How do I get
>   OutputMap:
>     IronicApiNetwork: 192.0.2.5
>     CephPublicNetwork: 192.0.2.2
>
> It seems like something yaql should be able to do, but I've so far failed
> to figure out the syntax.
>
> The other (possibly simpler) possibility is to implement a new hot
> function, e.g something like:
>
>   map_replace:
>     template: {get_param: ServiceNetMap}
>     value_replacements: {get_param: NetIpMap}
>
> The function could accept e.t value_replacements and key_replacements, and
> simply iterate over the map doing a key lookup and replacement on the
> key/value when they match.
>
> Anyone got any simpler ideas, or an example of what this would look like in
> yaql?
>
> Thanks!
>
> Steve
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Best regards,
Peter Razumovsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160715/bbf86731/attachment.html>


More information about the OpenStack-dev mailing list