From bfa7f8554b9ab6c385a9405d800fe8e26e8b0758 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Fri, 3 Jun 2016 15:42:43 -0400 Subject: [PATCH] Get rid of Parameters._validate_template_parameters() Apart from the fact that this method relied on knowledge of the template format, it also checked nothing useful since we now won't even be able to create the Parameters object unless all of the parameter definitions are in fact dicts. Change-Id: I950420b9016d350a427754d6a482b6ddf456bd6f --- heat/api/aws/exception.py | 1 - heat/api/middleware/fault.py | 1 - heat/common/exception.py | 4 ---- heat/engine/parameters.py | 13 ------------- heat/tests/test_hot.py | 1 - 5 files changed, 20 deletions(-) diff --git a/heat/api/aws/exception.py b/heat/api/aws/exception.py index 4bc8389567..a9ad6b53a5 100644 --- a/heat/api/aws/exception.py +++ b/heat/api/aws/exception.py @@ -306,7 +306,6 @@ def map_remote_error(ex): 'InvalidTemplateSection', 'UnknownUserParameter', 'UserParameterMissing', - 'InvalidTemplateParameter', 'MissingCredentialError', 'ResourcePropertyConflict', 'PropertyUnspecifiedError', diff --git a/heat/api/middleware/fault.py b/heat/api/middleware/fault.py index 7508f81ee0..8fa839f0d7 100644 --- a/heat/api/middleware/fault.py +++ b/heat/api/middleware/fault.py @@ -80,7 +80,6 @@ class FaultWrapper(wsgi.Middleware): 'MissingCredentialError': webob.exc.HTTPBadRequest, 'UserParameterMissing': webob.exc.HTTPBadRequest, 'RequestLimitExceeded': webob.exc.HTTPBadRequest, - 'InvalidTemplateParameter': webob.exc.HTTPBadRequest, 'Invalid': webob.exc.HTTPBadRequest, 'ResourcePropertyConflict': webob.exc.HTTPBadRequest, 'PropertyUnspecifiedError': webob.exc.HTTPBadRequest, diff --git a/heat/common/exception.py b/heat/common/exception.py index 01b62c47bf..7397645ae9 100644 --- a/heat/common/exception.py +++ b/heat/common/exception.py @@ -129,10 +129,6 @@ class InvalidTemplateSection(HeatException): msg_fmt = _("The template section is invalid: %(section)s") -class InvalidTemplateParameter(HeatException): - msg_fmt = _("The Parameter (%(key)s) has no attributes.") - - class ImmutableParameterModified(HeatException): msg_fmt = _("The following parameters are immutable and may not be " "updated: %(keys)s") diff --git a/heat/engine/parameters.py b/heat/engine/parameters.py index 8c13d6b6b5..11fde01cba 100644 --- a/heat/engine/parameters.py +++ b/heat/engine/parameters.py @@ -511,7 +511,6 @@ class Parameters(collections.Mapping): This method validates if all user-provided parameters are actually defined in the template, and if all parameters are valid. """ - self._validate_tmpl_parameters() self._validate_user_parameters() for param in six.itervalues(self.params): @@ -556,18 +555,6 @@ class Parameters(collections.Mapping): if param not in schemata: raise exception.UnknownUserParameter(key=param) - def _validate_tmpl_parameters(self): - param = None - for key in six.iterkeys(self.tmpl.t): - if key == 'Parameters' or key == 'parameters': - param = key - break - if param is not None: - template_params = self.tmpl.t[key] or {} - for name, attrs in six.iteritems(template_params): - if not isinstance(attrs, dict): - raise exception.InvalidTemplateParameter(key=name) - def _pseudo_parameters(self, stack_identifier): stack_id = (stack_identifier.arn() if stack_identifier is not None else 'None') diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py index 5ee4186427..351087c7cb 100644 --- a/heat/tests/test_hot.py +++ b/heat/tests/test_hot.py @@ -187,7 +187,6 @@ class HOTemplateTest(common.HeatTestCase): stack = parser.Stack(utils.dummy_context(), 'test_stack', tmpl) self.assertIsNone(stack.parameters._validate_user_parameters()) - self.assertIsNone(stack.parameters._validate_tmpl_parameters()) self.assertIsNone(stack.validate()) def test_translate_resources_good(self):