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

Sergey Kraynev skraynev at mirantis.com
Thu Mar 24 07:54:56 UTC 2016


Rabi,

Good point. I suppose, that the root cause of it is gap in our documentation.
Unfortunately I can not find any clear description what's the
differences or how it should work (especially with examples) in our
documentation. [1]

May be we need to improve it by adding more examples ?

[1] http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#get-attr

On 24 March 2016 at 08:39, Rabi Mishra <ramishra at redhat.com> 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]}
>> >    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?
>
> They are the same for template version 2013-05-23. However, they behave differently
> from the next  version(2014-10-16) onward and return a list of characters. I think
> this is due to the fact that `get_attr` function mapping is changed from 2014-10-16.
>
>
> 2013-05-23 -  https://github.com/openstack/heat/blob/master/heat/engine/hot/template.py#L70
> 2014-10-16 -  https://github.com/openstack/heat/blob/master/heat/engine/hot/template.py#L291
>
> This makes me wonder why would a template author do something like
> {get_attr: [rg_a, rg_a_public_ip, 0]} when he can easily do
> {get_attr: [rg_a, resource.0.rg_a_public_ip]} or {get_attr: [rg_a, resource.0, rg_a_public_ip]}
> for specific resource atrributes.
>
> I understand that {get_attr: [rg_a, rg_a_public_ip]} cane be useful when we just want to use
> the list of attributes.
>
>
>>
>> {get_attr: [rg_a, rg_a_public_ip]} should return a list of all
>> rg_a_public_ip attributes (one list item for each resource in the group),
>> then the 0 should select the first item from that list?
>>
>> If it's returning the first character of the first element, that sounds
>> like a bug to me?
>>
>> 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
>>
>
> __________________________________________________________________________
> 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



-- 
Regards,
Sergey.



More information about the OpenStack-dev mailing list