diff options
author | Angus Salkeld <asalkeld@mirantis.com> | 2014-11-24 12:38:30 +1000 |
---|---|---|
committer | Angus Salkeld <asalkeld@mirantis.com> | 2014-12-15 09:44:11 +1000 |
commit | 08431c7c0601f64e6f0477dd502bf912eba8529b (patch) | |
tree | 311f789278066da27db8b568898dc32f6153ce33 /heat/engine/hot | |
parent | e1540f834c7b12cfad67931b2dac3eef4ed4ea54 (diff) | |
download | heat-08431c7c0601f64e6f0477dd502bf912eba8529b.tar.gz |
Add "parameter_defaults" to the environment
This give the user a way to set defaults recursively down nested stacks
without having to create the parameter in every template (it's ignored
if the template does not have the parameter).
blueprint env-nested-usability
Change-Id: Ie6b4481417204a527d322fd532c341b9acbce473
Diffstat (limited to 'heat/engine/hot')
-rw-r--r-- | heat/engine/hot/template.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/heat/engine/hot/template.py b/heat/engine/hot/template.py index c0680e62c..16d53aefb 100644 --- a/heat/engine/hot/template.py +++ b/heat/engine/hot/template.py @@ -171,17 +171,21 @@ class HOTemplate20130523(template.Template): return self._translate_section('outputs', 'value', outputs, HOT_TO_CFN_ATTRS) - def param_schemata(self): - parameter_section = self.t.get(self.PARAMETERS) - if parameter_section is None: - parameter_section = {} + def param_schemata(self, param_defaults=None): + parameter_section = self.t.get(self.PARAMETERS) or {} + pdefaults = param_defaults or {} + for name, schema in six.iteritems(parameter_section): + if name in pdefaults: + parameter_section[name]['default'] = pdefaults[name] + params = six.iteritems(parameter_section) return dict((name, parameters.HOTParamSchema.from_dict(name, schema)) for name, schema in params) - def parameters(self, stack_identifier, user_params): + def parameters(self, stack_identifier, user_params, param_defaults=None): return parameters.HOTParameters(stack_identifier, self, - user_params=user_params) + user_params=user_params, + param_defaults=param_defaults) def resource_definitions(self, stack): allowed_keys = set(_RESOURCE_KEYS) |