[openstack-dev] [Heat] [TripleO] Better handling of lists in Heat - a proposal to add a map function
Randall Burt
randall.burt at RACKSPACE.COM
Wed Feb 19 17:46:17 UTC 2014
This may also be relevant: https://blueprints.launchpad.net/heat/+spec/override-resource-name-in-resource-group
On Feb 19, 2014, at 1:48 AM, Clint Byrum <clint at fewbar.com>
wrote:
> Since picking up Heat and trying to think about how to express clusters
> of things, I've been troubled by how poorly the CFN language supports
> using lists. There has always been the Fn::Select function for
> dereferencing arrays and maps, and recently we added a nice enhancement
> to HOT to allow referencing these directly in get_attr and get_param.
>
> However, this does not help us when we want to do something with all of
> the members of a list.
>
> In many applications I suspect the template authors will want to do what
> we want to do now in TripleO. We have a list of identical servers and
> we'd like to fetch the same attribute from them all, join it with other
> attributes, and return that as a string.
>
> The specific case is that we need to have all of the hosts in a cluster
> of machines addressable in /etc/hosts (please, Designate, save us,
> eventually. ;). The way to do this if we had just explicit resources
> named NovaCompute0, NovaCompute1, would be:
>
> str_join:
> - "\n"
> - - str_join:
> - ' '
> - get_attr:
> - NovaCompute0
> - networks.ctlplane.0
> - get_attr:
> - NovaCompute0
> - name
> - str_join:
> - ' '
> - get_attr:
> - NovaCompute1
> - networks.ctplane.0
> - get_attr:
> - NovaCompute1
> - name
>
> Now, what I'd really like to do is this:
>
> map:
> - str_join:
> - "\n"
> - - str_join:
> - ' '
> - get_attr:
> - "$1"
> - networks.ctlplane.0
> - get_attr:
> - "$1"
> - name
> - - NovaCompute0
> - NovaCompute1
>
> This would be helpful for the instances of resource groups too, as we
> can make sure they return a list. The above then becomes:
>
>
> map:
> - str_join:
> - "\n"
> - - str_join:
> - ' '
> - get_attr:
> - "$1"
> - networks.ctlplane.0
> - get_attr:
> - "$1"
> - name
> - get_attr:
> - NovaComputeGroup
> - member_resources
>
> Thoughts on this idea? I will throw together an implementation soon but
> wanted to get this idea out there into the hive mind ASAP.
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
More information about the OpenStack-dev
mailing list