Fix for HOT parameter types conversion

The HOT-to-MuranoPL converter did not support some types for Heat
Template's input parameters.
Type 'comma_delimited_list' was not supported at all which was leading
to unhandled exceptions during package import operation.
Type 'json' was suported, but the generated UI definition did not
contain 'type' attribute for appropriate field, which was leading to
unhadled exceptions when the UI form was about to be displayed.

This patch fixes both these issues.

Closes-Bug: #1450536

Change-Id: I539514cc7cd884f98278cf5c990e8833e1b09259
This commit is contained in:
Alexander Tivelkov 2015-04-30 20:22:14 +03:00 committed by Stan Lagun
parent 68494598ef
commit 2affdd5d7a
1 changed files with 2 additions and 5 deletions

View File

@ -116,12 +116,10 @@ class HotPackage(murano.packages.application_package.ApplicationPackage):
contract = '$'
parameter_type = value['type']
if parameter_type == 'string':
if parameter_type in ('string', 'comma_delimited_list', 'json'):
contract += '.string()'
elif parameter_type == 'number':
contract += '.int()'
elif parameter_type == 'json':
contract += '.object()'
else:
raise ValueError('Unsupported parameter type ' + parameter_type)
@ -295,7 +293,7 @@ class HotPackage(murano.packages.application_package.ApplicationPackage):
'label': name.title().replace('_', ' ')
}
parameter_type = parameter_spec['type']
if parameter_type == 'string':
if parameter_type in ('string', 'json', 'comma_delimited_list'):
translated['type'] = 'string'
elif parameter_type == 'number':
translated['type'] = 'integer'
@ -404,5 +402,4 @@ class HotPackage(murano.packages.application_package.ApplicationPackage):
}
]
}
return translated