[Heat] Reg accessing variables of resource group heat api

NANTHINI A A nanthini.a.a at ericsson.com
Wed Feb 13 13:48:38 UTC 2019


Hi ,
   As per your suggested change ,I am able to create network A1,network A2 ; in second iteration network b1,network b2 .But I want to reduce number of lines of variable params.hence tried using repeat function .But it is not working .Can you please let me know what is wrong here .

I am getting following error .
root at cic-1:~# heat stack-create test2 -f main.yaml
WARNING (shell) "heat stack-create" is deprecated, please use "openstack stack create" instead
ERROR: AttributeError: : resources.rg: : 'NoneType' object has no attribute 'parameters'

root at cic-1:~# cat main.yaml
heat_template_version: 2015-04-30

description: Shows how to look up list/map values by group index

parameters:
  sets:
    type: comma_delimited_list
    label: sets
    default: "A,B,C"
  net_names:
    type: json
    default:
     repeat:
       for each:
         <%set%>: {get_param: sets}
         template:
           - network1: Network<%set>1
             network2: Network<%set>2


resources:
  rg:
    type: OS::Heat::ResourceGroup
    properties:
      count: 3
      resource_def:
        type: nested.yaml
        properties:
          # Note you have to pass the index and the entire list into the
          # nested template, resolving via %index% doesn't work directly
          # in the get_param here
          index: "%index%"
          names: {get_param: net_names}

outputs:
  all_values:
    value: {get_attr: [rg, value]}
root at cic-1:~#


Thanks in advance.


Regards,
A.Nanthini

From: Rabi Mishra [mailto:ramishra at redhat.com]
Sent: Wednesday, February 13, 2019 9:07 AM
To: NANTHINI A A <nanthini.a.a at ericsson.com>
Cc: hjensas at redhat.com; openstack-dev at lists.openstack.org
Subject: Re: [Heat] Reg accessing variables of resource group heat api


On Tue, Feb 12, 2019 at 7:48 PM NANTHINI A A <nanthini.a.a at ericsson.com<mailto:nanthini.a.a at ericsson.com>> wrote:
Hi ,
    I followed the example given in random.yaml .But getting below error .Can you please tell me what is wrong here .

root at cic-1:~# heat stack-create test -f main.yaml
WARNING (shell) "heat stack-create" is deprecated, please use "openstack stack create" instead
ERROR: Property error: : resources.rg<nested_stack>.resources[0].properties: : Unknown Property names
root at cic-1:~# cat main.yaml
heat_template_version: 2015-04-30

description: Shows how to look up list/map values by group index

parameters:
  net_names:
    type: json
    default:
    - network1: NetworkA1
      network2: NetworkA2
    - network1: NetworkB1
      network2: NetworkB2


resources:
  rg:
    type: OS::Heat::ResourceGroup
    properties:
      count: 3
      resource_def:
        type: nested.yaml
        properties:
          # Note you have to pass the index and the entire list into the
          # nested template, resolving via %index% doesn't work directly
          # in the get_param here
          index: "%index%"
          names: {get_param: net_names}
 property name should be same as parameter name in you nested.yaml

outputs:
  all_values:
    value: {get_attr: [rg, value]}
root at cic-1:~# cat nested.yaml
heat_template_version: 2013-05-23
description:
  This is the template for I&V R6.1 base configuration to create neutron  resources other than sg and vm for vyos vms
parameters:
   net_names:
changing this to 'names' should fix your error.
     type: json
   index:
     type: number
resources:
  neutron_Network_1:
    type: OS::Neutron::Net
    properties:
      name: {get_param: [names, {get_param: index}, network1]}


Thanks,
A.Nanthini

From: Rabi Mishra [mailto:ramishra at redhat.com<mailto:ramishra at redhat.com>]
Sent: Tuesday, February 12, 2019 6:34 PM
To: NANTHINI A A <nanthini.a.a at ericsson.com<mailto:nanthini.a.a at ericsson.com>>
Cc: hjensas at redhat.com<mailto:hjensas at redhat.com>; openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>
Subject: Re: [Heat] Reg accessing variables of resource group heat api

On Tue, Feb 12, 2019 at 11:14 AM NANTHINI A A <nanthini.a.a at ericsson.com<mailto:nanthini.a.a at ericsson.com>> wrote:
Hi ,
   May I know in the following example given

parameters:
  resource_name_map:
    - network1: foo_custom_name_net1
      network2: foo_custom_name_net2
    - network1: bar_custom_name_net1
      network2: bar_custom_name_net2
   what is the parameter type ?

json



--
Regards,
Rabi Mishra

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20190213/b120f9e8/attachment-0001.html>


More information about the openstack-discuss mailing list