Merge "Don't swallow AssertionErrors"

This commit is contained in:
Jenkins
2015-05-25 18:39:46 +00:00
committed by Gerrit Code Review
3 changed files with 12 additions and 2 deletions

View File

@@ -66,6 +66,8 @@ class StackResource(resource.Resource):
self.child_params())
nested_stack.strict_validate = False
nested_stack.validate()
except AssertionError:
raise
except Exception as ex:
raise exception.StackValidationFailed(
error=_("Failed to validate"),

View File

@@ -556,6 +556,8 @@ class EngineService(service.Service):
def _validate_new_stack(self, cnxt, stack_name, parsed_template):
try:
parsed_template.validate()
except AssertionError:
raise
except Exception as ex:
raise exception.StackValidationFailed(message=six.text_type(ex))

View File

@@ -647,8 +647,10 @@ class Stack(collections.Mapping):
try:
result = res.validate()
except exception.HeatException as ex:
LOG.info(ex)
LOG.debug('%s', ex)
raise ex
except AssertionError:
raise
except Exception as ex:
LOG.exception(_LE("Exception: %s"), ex)
raise exception.StackValidationFailed(
@@ -674,7 +676,9 @@ class Stack(collections.Mapping):
path=[self.t.OUTPUTS],
message=message)
except exception.StackValidationFailed as ex:
raise ex
raise
except AssertionError:
raise
except Exception as ex:
raise exception.StackValidationFailed(
error='Output validation error',
@@ -1559,6 +1563,8 @@ class Stack(collections.Mapping):
def resolve_static_data(self, snippet):
try:
return self.t.parse(self, snippet)
except AssertionError:
raise
except Exception as ex:
raise exception.StackValidationFailed(
message=encodeutils.safe_decode(six.text_type(ex)))