Openstack热环境参数文件默认值无效报错

Openstack heat environment parameter file default value invalid error

我正在尝试使用模板文件和环境参数文件创建堆栈。以下是我的详细信息。

在模板文件中:

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 }

环境文件:

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

当我尝试创建堆栈时,出现以下错误:

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

我已将 v6_gateway 定义为字符串,默认值为 0。它接受的 v4_gateway 也是如此。为什么它会为 v6_gateway 抛出错误?还有怎么解决?

PS: 我用的是openstack newton版本

问题是您的默认网关是一个数字,而不是一个字符串。如果您确实需要默认的 0 按原样有效,您可以用撇号将其包装起来。

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