Add support for 'boolean' HOT parameter

The HOT-to-MuranoPL converter did not support 'boolean' type as Heat
Template input parameter. This lead to a
400 'Unsupported parameter type boolean', during package uploads.

This patch adds support for boolean type, adds .bool() to boolean field
contracts and adds 'boolean' UI type during UI translation.

Change-Id: I960473916e70f9e17e5b5b1c228b7efd1deb98b5
Closes-Bug: #1450536
This commit is contained in:
Kirill Zaitsev 2015-05-27 00:31:29 +03:00
parent efee9edbfb
commit e89f3f4c3d

View File

@ -120,6 +120,8 @@ class HotPackage(murano.packages.application_package.ApplicationPackage):
contract += '.string()' contract += '.string()'
elif parameter_type == 'number': elif parameter_type == 'number':
contract += '.int()' contract += '.int()'
elif parameter_type == 'boolean':
contract += '.bool()'
else: else:
raise ValueError('Unsupported parameter type ' + parameter_type) raise ValueError('Unsupported parameter type ' + parameter_type)
@ -332,10 +334,15 @@ class HotPackage(murano.packages.application_package.ApplicationPackage):
'label': name.title().replace('_', ' ') 'label': name.title().replace('_', ' ')
} }
parameter_type = parameter_spec['type'] parameter_type = parameter_spec['type']
if parameter_type in ('string', 'json', 'comma_delimited_list'): if parameter_type == 'number':
translated['type'] = 'string'
elif parameter_type == 'number':
translated['type'] = 'integer' translated['type'] = 'integer'
elif parameter_type == 'boolean':
translated['type'] = 'boolean'
else:
# string, json, and comma_delimited_list parameters are all
# displayed as strings in UI. Any unsuported parameter would also
# be displayed as strings.
translated['type'] = 'string'
label = parameter_spec.get('label') label = parameter_spec.get('label')
if label: if label: