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

asked 2016-03-15 21:36:21 -0500

Jeffrey Guan gravatar image
  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.

Thanks,

edit retag flag offensive close merge delete