'NotSupported': webob.exc.HTTPBadRequest,
'MissingCredentialError': webob.exc.HTTPBadRequest,
'UserParameterMissing': webob.exc.HTTPBadRequest,
+ 'RequestLimitExceeded': webob.exc.HTTPBadRequest,
}
def _error(self, ex):
self.tb = sys.exc_info()[2]
-class TemplateTooBig(HeatException):
- message = _('Template exceeds maximum allowed size.')
-
-
class EgressRuleNotAllowed(HeatException):
message = _("Egress rules are only allowed when "
"Neutron is used and the 'VpcId' property is set.")
message = "Invalid content type %(content_type)s"
-class StackRecursionLimitReached(HeatException):
- message = _("Recursion depth exceeds %d.")
-
- def __init__(self, recursion_depth):
- self.message = self.message % recursion_depth
- super(StackRecursionLimitReached, self).__init__()
-
-
class RequestLimitExceeded(HeatException):
message = _('Request limit exceeded: %(message)s')
JSON or YAML format.
'''
if len(tmpl_str) > cfg.CONF.max_template_size:
- raise exception.TemplateTooBig()
+ msg = _('Template exceeds maximum allowed size.')
+ raise exception.RequestLimitExceeded(message=msg)
if tmpl_str.startswith('{'):
tpl = json.loads(tmpl_str)
else:
Handle the creation of the nested stack from a given JSON template.
'''
if self.recursion_depth >= cfg.CONF.max_nested_stack_depth:
- raise exception.StackRecursionLimitReached(
- cfg.CONF.max_nested_stack_depth)
+ msg = _("Recursion depth exceeds %d.") % \
+ cfg.CONF.max_nested_stack_depth
+ raise exception.RequestLimitExceeded(message=msg)
template = parser.Template(child_template)
self._outputs_to_attribs(child_template)
limit = config.cfg.CONF.max_template_size
long_yaml = yaml.safe_dump(template)
self.assertTrue(len(long_yaml) > limit)
- self.assertRaises(exception.TemplateTooBig, template_format.parse,
- long_yaml)
+ ex = self.assertRaises(exception.RequestLimitExceeded,
+ template_format.parse, long_yaml)
+ msg = 'Request limit exceeded: Template exceeds maximum allowed size.'
+ self.assertEqual(msg, str(ex))
class JsonYamlResolvedCompareTest(HeatTestCase):