[openstack-dev] [Heat] [TripleO] Extended get_attr support for ResourceGroup

Tomas Sedovic tsedovic at redhat.com
Wed Jul 16 13:52:35 UTC 2014


On 15/07/14 20:43, Tomas Sedovic wrote:
> On 15/07/14 20:01, Zane Bitter wrote:
>> On 14/07/14 12:21, Tomas Sedovic wrote:
>>> On 12/07/14 06:41, Zane Bitter wrote:
>>>> On 11/07/14 09:37, Tomas Sedovic wrote:
>>
> [snip]
>>>
>>>>
>>>> There is one aspect of this that probably doesn't work yet: originally
>>>> outputs and attributes were only allowed to be strings. We changed that
>>>> for attributes, but probably not yet for outputs (even though outputs of
>>>> provider templates become attributes of the facade resource). But that
>>>> should be easy to fix. (And if your data can be returned as a string, it
>>>> should already work.)
>>>
>>> Unless I misunderstood what you're saying, it seems to be working now:
>>>
>>> controller.yaml:
>>>
>>>      outputs:
>>>        hosts_entry:
>>>          description: An IP address and a hostname of the server
>>>          value:
>>>            ip: {get_attr: [controller_server, networks, private, 0]}
>>>            name: {get_attr: [controller_server, name]}
>>>
>>> environment.yaml:
>>>
>>>      resource_registry:
>>>        OS::TripleO::Controller: controller.yaml
>>>
>>> test-resource-group.yaml:
>>>
>>>      resources:
>>>        servers:
>>>          type: OS::Heat::ResourceGroup
>>>          properties:
>>>            count: 3
>>>            resource_def:
>>>              type: OS::TripleO::Controller
>>>              properties:
>>>                key_name: {get_param: key_name}
>>>                image: {get_param: image_id}
>>>
>>>      outputs:
>>>        hosts:
>>>          description: "/etc/hosts entries for each server"
>>>          value: {get_attr: [servers, hosts_entry]}
>>>
>>> Heat stack-show test-resource-group:
>>>
>>>     {
>>>       "output_value": [
>>>         "{u'ip': u'10.0.0.4', u'name':
>>> u'rg-7heh-0-tweejsvubaht-controller_server-mscy33sbtirn'}",
>>>         "{u'ip': u'10.0.0.3', u'name':
>>> u'rg-7heh-1-o4szl7lry27d-controller_server-sxpkalgi27ii'}",
>>>         "{u'ip': u'10.0.0.2', u'name':
>>> u'rg-7heh-2-l2y6rqxml2fi-controller_server-u4jcjacjdrea'}"
>>>       ],
>>>       "description": "/etc/hosts entries for each server",
>>>       "output_key": "hosts"
>>>     },
>>
>> It looks like the dicts are being converted to strings by Python, so
>> there probably is a small bug here to be fixed. (At the very least, if
>> we're converting to strings we should do so using json.dumps(), not
>> repr().)
> 
> Ooops, you're right. In my excitement, I completely missed that!

Looks like there's a bug filed for this already:

https://bugs.launchpad.net/heat/+bug/1297938



> 
>>
>> [snip]




More information about the OpenStack-dev mailing list