Improve StackValidationFailed response in nested
Improve StackValidationFailed response in nested stacks, add resource name to path, where validation failed. Change-Id: If7bbeb8634736f4167bba2d64625837a7dc2137d
This commit is contained in:
parent
308143e3d2
commit
4f9f6635bb
|
@ -66,8 +66,10 @@ class StackResource(resource.Resource):
|
|||
nested_stack.strict_validate = False
|
||||
nested_stack.validate()
|
||||
except Exception as ex:
|
||||
msg = _("Failed to validate: %s") % six.text_type(ex)
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
raise exception.StackValidationFailed(
|
||||
error=_("Failed to validate"),
|
||||
path=[self.stack.t.get_section_name('resources'), self.name],
|
||||
message=six.text_type(ex))
|
||||
|
||||
def _outputs_to_attribs(self, json_snippet):
|
||||
outputs = json_snippet.get('Outputs')
|
||||
|
|
|
@ -363,17 +363,18 @@ class StackResourceTest(common.HeatTestCase):
|
|||
stack = parser.Stack(utils.dummy_context(), stack_name,
|
||||
templatem.Template(tmpl, files=files))
|
||||
rsrc = stack['volume_server']
|
||||
raise_exc_msg = ('The specified reference "instance" ('
|
||||
'in volume_attachment.Properties.instance_uuid) '
|
||||
'is incorrect')
|
||||
raise_exc_msg = ('Failed to validate : resources.volume_server: '
|
||||
'The specified reference "instance" '
|
||||
'(in volume_attachment.Properties.instance_uuid) '
|
||||
'is incorrect.')
|
||||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
rsrc.validate)
|
||||
self.assertIn(raise_exc_msg, six.text_type(exc))
|
||||
self.assertEqual(raise_exc_msg, six.text_type(exc))
|
||||
|
||||
def _test_validate_unknown_resource_type(self, stack_name, tmpl,
|
||||
resource_name,
|
||||
stack_resource=True):
|
||||
raise_exc_msg = ('The Resource Type (idontexist) could not be found.')
|
||||
raise_exc_msg = 'The Resource Type (idontexist) could not be found.'
|
||||
stack = parser.Stack(utils.dummy_context(), stack_name, tmpl)
|
||||
rsrc = stack[resource_name]
|
||||
if stack_resource:
|
||||
|
|
Loading…
Reference in New Issue