Only the first get_attr works in the "params" part of str_replace.

Bug #1557834 reported by Jeffrey Guan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Incomplete
Undecided
lavanya

Bug Description

server001_net0:
    type: OS::Neutron::Port
    properties:
      name:
        str_replace:
          template: $name-net0
          params:
            $name: {get_param: name}
      network_id: {get_param: net0}
      fixed_ips:
        - ip_address: {get_param: [ static_net0_ip_list, {get_param: indx} ]}

  server001_net2:
    type: OS::Neutron::Port
    properties:
      name:
        str_replace:
          template: $name-net2
          params:
            $name: {get_param: name}
      network_id: {get_param: net2}

      fixed_ips: [
            {"ip_address": {get_param: [ static_net2_ip_list, {get_param: indx} ]},"subnet_id": {get_param: net2_subnet} } ]

  server001:
    type: OS::Nova::Server
    properties:

      name:
        str_replace:
          template: $hostname
          params:
            $hostname: {get_param: [ static_name_list, {get_param: indx} ]}

      availability_zone: {get_param: zoneX}
      flavor: {get_param: flavor}
      config_drive: True
      key_name: {get_param: key_name}
      image: {get_param: image}
      user_data_format: RAW
      user_data:
        str_replace:
          template: $user_str
          params:
            $user_str: {get_param: user_data}
            $IP_ADDR: {get_attr: [server001_net2, fixed_ips, 0, "ip_address"]}
            $ipaddress: {get_param: [server001_net0, fixed_ips, 0, "ip_address"]}
Where static_net0_ip_list and static_net2_ip_list are as follows: static_net0_ip_list=[ "node0": 192.168.11.1 "node1": 192.168.11.2 ] static_net2_ip_list=[ "node0": 192.168.11.5 "node1": 192.168.11.6 ]

ISSUES: This" $ipaddress: {get_param: [server001_net0, fixed_ips, 0, "ip_address"]}" cannot setup the valuse for ipaddress. It shows that the value of ipaddress is null

Could you please help to have a check? Thank you very much.

lavanya (lavanya-annam)
Changed in heat-templates:
assignee: nobody → lavanya (lavanya-annam)
lavanya (lavanya-annam)
description: updated
Revision history for this message
lavanya (lavanya-annam) wrote :

If you want to setup the value for $ipaddress, you need mention this variable in template like this

template: $user_str, $ipaddress

By modifying the template statement you may setup the value for $ipaddress. Try that statement, let me know if you still face any issues.

Revision history for this message
Jeffrey Guan (double12gzh) wrote :

yes,that param you mentioned already in statement.

Revision history for this message
lavanya (lavanya-annam) wrote :

No it was not there in template section. Whatever variables you want use in params section you need to declare those variables in template section. Ex:

template: $user_str, $ipaddress, $IP_ADDR

If its not the solution for your problem please attach the updated template file and the error.

lavanya (lavanya-annam)
Changed in heat-templates:
status: New → Incomplete
Zane Bitter (zaneb)
affects: heat-templates → heat
Rico Lin (rico-lin)
Changed in heat:
milestone: none → no-priority-tag-bugs
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.