parameters:
InstanceType:
type: string
description: Instance type for WordPress server
default: m1.small
constraints:
- allowed_values: [m1.small, m1.medium, m1.large] description: InstanceType must be one of m1.small, m1.medium or m1.large
ImageId:
type: string
description: ID of the image to use for the WordPress server
default: F18-x86_64-cfntools
constraints:
- allowed_values: [ F18-i386-cfntools, F18-x86_64-cfntools ] description: >
Image ID bust be either F18-i386-cfntools or F18-x86_64-cfntools
DBName:
type: string
description: WordPress database name
default: wordpress
constraints:
- length: { min: 1, max: 64 } description: DBName must be between 1 and 64 characters
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*' description: >
DBName must begin with a letter and contain only alphanumeric characters
Confirmed, my testing indicates the same. We really need to fix this ASAP..
Here's a reproducer.
1. Create minimal provider resource template which has constraints on a parameter
# cat /tmp/hot_ minimal. yaml version: 2013-05-23
heat_template_
parameters:
description: InstanceType must be one of m1.small, m1.medium or m1.large
description: >
description: DBName must be between 1 and 64 characters Z][a-zA- Z0-9]*'
description: >
characters
InstanceType:
type: string
description: Instance type for WordPress server
default: m1.small
constraints:
- allowed_values: [m1.small, m1.medium, m1.large]
ImageId:
type: string
description: ID of the image to use for the WordPress server
default: F18-x86_64-cfntools
constraints:
- allowed_values: [ F18-i386-cfntools, F18-x86_64-cfntools ]
Image ID bust be either F18-i386-cfntools or F18-x86_64-cfntools
DBName:
type: string
description: WordPress database name
default: wordpress
constraints:
- length: { min: 1, max: 64 }
- allowed_pattern: '[a-zA-
DBName must begin with a letter and contain only alphanumeric
resources: instance:
wordpress_
type: OS::Nova::Server
properties:
image: { get_param: ImageId }
flavor: { get_param: InstanceType }
2. Create an environment file pointing to the template above
# cat env_minimal.yaml :Custom: :Server" : file:// /tmp/hot_ minimal. yaml
resource_registry:
# Define a custom resource type based on a template
"My:
3 . Create a template which uses the provder resource
# cat minimal_test.yaml version: 2013-05-23
heat_template_
resources: instance:
wordpress_
type: My::Custom::Server
4. Launch the template
heat --debug create test_stack --template- file=./ minimal_ test.yaml --environment- file=./ env_minimal. yaml
We get this in the engine log:
2013-09-18 14:51:01.628 7560 INFO heat.engine. environment [-] Registering My::Custom::Server -> file:// /tmp/hot_ minimal. yaml common. rpc.amqp [-] Exception during message handling common. rpc.amqp Traceback (most recent call last): common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/openstack/ common/ rpc/amqp. py", line 461, in _process_data common. rpc.amqp **args) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/openstack/ common/ rpc/dispatcher. py", line 172, in dispatch common. rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ service. py", line 56, in wrapped common. rpc.amqp return func(self, ctx, *args, **kwargs) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ service. py", line 256, in create_stack common. rpc.amqp env, **common_params) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ parser. py", line 108, in __init__ common. rpc.amqp for (name, data) in template_ resources. items() ) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ parser. py", line 108, in <genexpr> common. rpc.amqp for (name, data) in template_ resources. items() ) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ resource. py", line 133, in __new__ common. rpc.amqp return ResourceClass(name, json, stack) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ resources/ template_ resource. py", line 55, in __init__ common. rpc.amqp .schema_ from_params( tmpl.param_ schemata( ))) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 658, in schema_from_params common. rpc.amqp in params_ snippet. items() ) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 657, in <genexpr> common. rpc.amqp return dict((n, Schema. from_parameter( p)) for n, p common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 219, in from_parameter common. rpc.amqp constraints= list(constraint s())) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 209, in constraints common. rpc.amqp yield Length( get_num( parameters. MIN_LENGTH) , common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 199, in get_num common. rpc.amqp val = Property. str_to_ num(val) common. rpc.amqp File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 539, in str_to_num common. rpc.amqp return int(value) common. rpc.amqp TypeError: int() argument must be a string or a number, not 'list' common. rpc.amqp common. rpc.common [-] Returning exception int() argument must be a string or a number, not 'list' to caller common. rpc.common [-] ['Traceback (most recent call last):\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/openstack/ common/ rpc/amqp. py", line 461, in _process_data\n **args)\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/openstack/ common/ rpc/dispatcher. py", line 172, in dispatch\n result = getattr(proxyobj, method)(ctxt, **kwargs)\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ service. py", line 56, in wrapped\n return func(self, ctx, *args, **kwargs)\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ service. py", line 256, in create_stack\n env, **common_ params) \n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ parser. py", line 108, in __init__\n for (name, data) in template_ resources. items() )\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ parser. py", line 108, in <genexpr>\n for (name, data) in template_ resources. items() )\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ resource. py", line 133, in __new__\n return ResourceClass(name, json, stack)\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ resources/ template_ resource. py", line 55, in __init__\n .schema_ from_params( tmpl.param_ schemata( )))\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 658, in schema_ from_params\ n in params_ snippet. items() )\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 657, in <genexpr>\n return dict((n, Schema. from_parameter( p)) for n, p\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 219, in from_parameter\n constraints= list(constraint s()))\n' , ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 209, in constraints\n yield Length( get_num( parameters. MIN_LENGTH) ,\n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 199, in get_num\n val = Property. str_to_ num(val) \n', ' File "/usr/lib/ python2. 7/site- packages/ heat/engine/ properties. py", line 539, in str_to_num\n return int(value)\n', "TypeError: int() argument must be a string or a number, not 'list'\n"]
SHDEBUG getting num val for MinLength from [(1, u'DBName must be between 1 and 64 characters')]
2013-09-18 14:51:01.630 7560 ERROR heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.630 7560 TRACE heat.openstack.
2013-09-18 14:51:01.631 7560 ERROR heat.openstack.
2013-09-18 14:51:01.631 7560 ERROR heat.openstack.