[openstack-dev] [heat] issue of ResourceGroup in Heat template

Steven Hardy shardy at redhat.com
Thu Mar 24 08:35:53 UTC 2016


On Wed, Mar 23, 2016 at 05:05:17PM -0400, Zane Bitter wrote:
> On 23/03/16 13:35, Steven Hardy wrote:
> >On Wed, Mar 23, 2016 at 05:25:57PM +0300, Sergey Kraynev wrote:
> >>    Hello,
> >>    It looks similar on issue, which was discussed here [1]
> >>    I suppose, that the root cause is incorrect using get_attr for your case.
> >>    Probably you got "list"  instead of "string".
> >>    F.e. if I do something similar:
> >>    outputs:
> >>      rg_1:
> >>        value: {get_attr: [rg_a, rg_a_public_ip]}
> >>      rg_2:
> >>        value: {get_attr: [rg_a, rg_a_public_ip, 0]}
> >>
> >>      rg_3:
> >>        value: {get_attr: [rg_a]}
> >>      rg_4:
> >>        value: {get_attr: [rg_a, resource.0.rg_a_public_ip]}
> 
> There's actually another option here too that I personally prefer:
> 
>   rg_5:
>     value: {get_attr: [rg_a, resource.0, rg_a_public_ip]}
> 
> >>    where rg_a is also resource group which uses custom template as resource.
> >>    the custom template has output value rg_a_public_ip.
> >>    The output for it looks like [2]
> >>    So as you can see, that in first case (like it is used in your example),
> >>    get_attr returns list with one element.
> >>    rg_2 is also wrong, because it takes first symbol from sting with IP
> >>    address.
> >
> >Shouldn't rg_2 and rg_4 be equivalent?
> 
> Nope, rg_2 returns:
> 
>   [<public_ip_0>[0], <public_ip_1>[0], ...]
> 
> If this makes no sense, imagine that rg_a_public_ip is actually a map rather
> than a string. If you want to pick one key out of the map on each member and
> return the list of all of them, then you just have to add the key as the
> next argument to get_attr. This makes get_attr on a resource group work
> somewhat differently to other resources, but it's the only sensible way to
> express this in a template:

Ah, yeah I was thinking of the returned list containing simple string IP's
vs a map, this makes more sense now - thanks!

It has to be said, this RG attributes interface is really confusing, even
for all of us, so we probably need to improve the docs for users.

I did create this example template a long time ago, but it seems based on
this discussion that it's in need of an update and more comments (probably
in addition to improving the resource docs as well).

https://github.com/openstack/heat-templates/blob/master/hot/resource_group/resource_group.yaml

Cheers,

Steve



More information about the OpenStack-dev mailing list