diff --git a/heat/engine/software_config_io.py b/heat/engine/software_config_io.py index 5685fc3b79..8ca2d28f7b 100644 --- a/heat/engine/software_config_io.py +++ b/heat/engine/software_config_io.py @@ -129,11 +129,16 @@ class InputConfig(IOConfig): def __init__(self, value=_no_value, **config): if TYPE in config and DEFAULT in config: - self.schema = copy.deepcopy(self.schema) - config_param = parameters.Schema.from_dict( - 'config', {'Type': config[TYPE]}) - self.schema[DEFAULT] = properties.Schema.from_parameter( - config_param) + if config[DEFAULT] == '' and config[TYPE] != STRING_TYPE: + # This is a legacy path, because default used to be of string + # type, so we need to skip schema validation in this case. + pass + else: + self.schema = copy.deepcopy(self.schema) + config_param = parameters.Schema.from_dict( + 'config', {'Type': config[TYPE]}) + self.schema[DEFAULT] = properties.Schema.from_parameter( + config_param) super(InputConfig, self).__init__(**config) self._value = value diff --git a/heat/tests/engine/service/test_software_config.py b/heat/tests/engine/service/test_software_config.py index ee474b9f02..c99d15565e 100644 --- a/heat/tests/engine/service/test_software_config.py +++ b/heat/tests/engine/service/test_software_config.py @@ -1058,3 +1058,11 @@ class SoftwareConfigIOSchemaTest(common.HeatTestCase): inp = swc_io.InputConfig(name=name, type='Number', default='0') self.assertEqual(0, inp.default()) + + def test_input_config_value_ignore_string(self): + name = 'baz' + inp = swc_io.InputConfig(name=name, type='Number', + default='') + + self.assertEqual({'type': 'Number', 'name': 'baz', 'default': ''}, + inp.as_dict())