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

Steven Hardy shardy at redhat.com
Fri Jul 15 09:25:39 UTC 2016


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



More information about the OpenStack-dev mailing list