[Openstack] HOT ResourceGroup index referencing with get_attr

Lars-Erik Helander lars-erik.helander at proceranetworks.com
Sun Mar 12 15:59:34 UTC 2017


I think you need to pass %index% in a string, e.g.

            type: Turbo::LoadBalancerMember
            properties:
              index: “%index%”
              instance: { get_attr: [instance, instance] }
              pool: { get_attr: [listener_tcp_8301, pool] }


/Lasse

On 2017-03-12, 16:09, "Turbo Fredriksson" <turbo at bayour.com> wrote:

    On 12 Mar 2017, at 14:50, Turbo Fredriksson <turbo at bayour.com> wrote:
    
    > So how do you pass on ‘%index%’ to that child?
    > 
    > Because I still need to “retrieve” the IP with get_attr so I can send it to the child..
    
    Well, I could just send the whole ‘instance’ ID, and in the child retrieve it.
    
    But I still can’t figure out how to “send” it to the child:
    
    —— s n i p ——
      member_tcp_8301:
        type: OS::Heat::ResourceGroup
        properties:
          count: { get_param: capacity }
          resource_def:
            type: Turbo::LoadBalancerMember
            properties:
              index: %index%
              instance: { get_attr: [instance, instance] }
              pool: { get_attr: [listener_tcp_8301, pool] }
              port: 8301
    —— s n i p ——
    
    gives:
    
    —— s n i p ——
    found character '%' that cannot start any token
      in "<unicode string>", line 71, column 18:
                  index: %index%
    —— s n i p ——
    
    This with a child like:
    
    —— s n i p ——
    heat_template_version: 2015-04-30
    description: Add an instance to a Loadbalancer pool listener.
    
    parameters:
      instance:
        type: string
        description: Instance ID of the instance to add to the listener.
    
      pool:
        type: string
        description: Pool ID of the pool to add the instance to.
    
      port:
        type: string
        description: Port number to forward from the listner to the instance.
    
      index:
        type: number
        description: Index in address list to use
    
    resources:
      member:
        type: OS::Neutron::LBaaS::PoolMember
        properties:
          address: { get_attr: [{ get_param: instance }, address, index] }
          subnet: { get_attr: [{ get_param: subnet }, port_subnet, index] }
          pool: { get_param: pool }
          protocol_port: { get_param: port }
    
    outputs:
      member:
        value: { get_resource: member }
        description: The member ID.
    —— s n i p ——
    
    
    _______________________________________________
    Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
    Post to     : openstack at lists.openstack.org
    Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
    



More information about the Openstack mailing list