openstackopenstack-heat

Openstack heat environment parameter file default value invalid error


I'm trying to create a stack with a template file and an environment parameter file. Below are my details.

In Template File:

v6_ip:
  type: string
  description: ipv6 address
  constraints:
    - length: { min: 1, max: 46 }
  default: 0

v6_prefix_len:
  type: number
  description: ipv6 prefix length
  constraints:
    - range: { min: 0, max: 128 }
  default: 0

v6_gateway:
  type: string
  description: ipv6 default gateway
  constraints:
    - length: { min: 1, max: 46 }
  default: 0

server:
    type: OS::Nova::Server
    properties:
      name: { get_param : my_name }
      metadata:
      config_drive: True
      user_data:
        params:      
          $IPV4: { get_param: v4_ip }
          $V4_NETMASK: { get_param: v4_netmask }
          $V4_GW: { get_param: v4_gateway }
          $IPV6: { get_param: v6_ip }
          $V6_PREFIX: { get_param: v6_prefix_len }
          $V6_GW: { get_param: v6_gateway }

The environment file:

v4_ip: 192.168.11.179
v4_netmask: 255.255.240.0
v4_gateway: 192.168.0.254
v6_ip: fd5d:d50a:8c17:2110::2019
v6_prefix_len: 64
v6_gateway: fd5d:d50a:8c17:2110::ff

When I try to create the stack, I'm getting the below error:

ERROR: Parameter 'v6_gateway' is invalid: Invalid default 0 (object of type 'int' has no len())

I've defined v6_gateway as string and default value is 0. The same thing for v4_gateway it's accepting. Why it's throwing an error for v6_gateway? Also how to resolve it?

PS: I'm using openstack newton version.


Solution

  • The problem is that your default gateway is an number, and not a string. If you really need the default 0 to be valid as-is, you can wrap it with apostrophes.

    v6_gateway:
      type: string
      description: ipv6 default gateway
      constraints:
        - length: { min: 1, max: 46 }
      default: '0'