From e89f3f4c3d7d39fe10fd8399a351e88f0a88bc8f Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Wed, 27 May 2015 00:31:29 +0300 Subject: [PATCH] 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 --- murano/packages/hot_package.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/murano/packages/hot_package.py b/murano/packages/hot_package.py index 6e8115e0..c6bbc794 100644 --- a/murano/packages/hot_package.py +++ b/murano/packages/hot_package.py @@ -120,6 +120,8 @@ class HotPackage(murano.packages.application_package.ApplicationPackage): contract += '.string()' elif parameter_type == 'number': contract += '.int()' + elif parameter_type == 'boolean': + contract += '.bool()' else: raise ValueError('Unsupported parameter type ' + parameter_type) @@ -332,10 +334,15 @@ class HotPackage(murano.packages.application_package.ApplicationPackage): 'label': name.title().replace('_', ' ') } parameter_type = parameter_spec['type'] - if parameter_type in ('string', 'json', 'comma_delimited_list'): - translated['type'] = 'string' - elif parameter_type == 'number': + if parameter_type == 'number': 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') if label: