Don't swallow AssertionErrors
Most validation errors are in fact the user's problem, but in the case of an AssertionError that's a real problem with Heat. We should return 500 status codes and log the tracebacks, not wrap the in validation exceptions. Change-Id: I71d91a5413d7f026b332014487583b7f2762b322
This commit is contained in:
parent
60300b0149
commit
1c78d4af85
|
@ -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"),
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -642,8 +642,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(
|
||||
|
@ -669,7 +671,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',
|
||||
|
@ -1555,6 +1559,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)))
|
||||
|
|
Loading…
Reference in New Issue