Re: [openstack-dev] [heat] Question about retrieving resource_list from ResourceGroup

2015-07-01 Thread Zane Bitter

On 26/06/15 15:14, Hongbin Lu wrote:

Hi team,

I would like to start my question by using a sample template:

heat_template_version: 2014-10-16

parameters:

   count:

 type: number

 default: 5

   removal_list:

 type: comma_delimited_list

 default: []

resources:

   sample_group:

 type: OS::Heat::ResourceGroup

 properties:

   count: {get_param: count}

   removal_policies: [{resource_list: {get_param: removal_list}}]

   resource_def:

 type: testnested.yaml

outputs:

   resource_list:

value: # How to output a list of resources of sample_group? Like
resource_list: ['0', '1', '2', '3', '4']?

As showed above, this template has a resource group that contains
resources defined in a nested template. First, I am going to use this
template to create a stack. Then, I am going to update the stack to
scale down the resource group by specifying (through parameters) a
subset of resources that I want to remove. For example,

$  heat stack-create -f test.yaml test

$ heat stack-show test

$ heat stack-update -f test.yaml -P count=3;removal_list=1,3 test

I want to know if it is possible to output a “resource_list” that lists
all the removal candidate, so that I can programmatically process the
list to compile another list (that is “removal_list”) which will be
passed back to the template as a parameter. Any help will be appreciated.


This is not really an openstack-dev@ question, and would be better 
directed at the openstack@ mailing list or, preferably, ask.openstack.org.


That said, assuming you're running Juno, the 'outputs' attribute[1] will 
return a dict of the outputs from the ResourceGroup members, so you can 
infer the membership from the keys in that dict.


cheers,
Zane.

[1] 
http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::AutoScalingGroup-attrs


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [heat] Question about retrieving resource_list from ResourceGroup

2015-06-26 Thread Hongbin Lu
Hi team,

I would like to start my question by using a sample template:

heat_template_version: 2014-10-16
parameters:
  count:
type: number
default: 5
  removal_list:
type: comma_delimited_list
default: []
resources:
  sample_group:
type: OS::Heat::ResourceGroup
properties:
  count: {get_param: count}
  removal_policies: [{resource_list: {get_param: removal_list}}]
  resource_def:
type: testnested.yaml
outputs:
  resource_list:
value: # How to output a list of resources of sample_group? Like 
resource_list: ['0', '1', '2', '3', '4']?

As showed above, this template has a resource group that contains resources 
defined in a nested template. First, I am going to use this template to create 
a stack. Then, I am going to update the stack to scale down the resource group 
by specifying (through parameters) a subset of resources that I want to remove. 
For example,

$  heat stack-create -f test.yaml test

$ heat stack-show test

$ heat stack-update -f test.yaml -P count=3;removal_list=1,3 test

I want to know if it is possible to output a resource_list that lists all the 
removal candidate, so that I can programmatically process the list to compile 
another list (that is removal_list) which will be passed back to the template 
as a parameter. Any help will be appreciated.

Thanks,
Honbgin
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev