Merge "Enable ResourceUnknownStatus to report status_reason"
This commit is contained in:
commit
e1540f834c
@ -69,10 +69,13 @@ class ResourceInError(exception.HeatException):
|
||||
|
||||
|
||||
class ResourceUnknownStatus(exception.HeatException):
|
||||
msg_fmt = _('%(result)s - Unknown status %(resource_status)s')
|
||||
msg_fmt = _('%(result)s - Unknown status %(resource_status)s due to '
|
||||
'"%(status_reason)s"')
|
||||
|
||||
def __init__(self, result=_('Resource failed'), **kwargs):
|
||||
super(ResourceUnknownStatus, self).__init__(result=result, **kwargs)
|
||||
def __init__(self, result=_('Resource failed'),
|
||||
status_reason=_('Unknown'), **kwargs):
|
||||
super(ResourceUnknownStatus, self).__init__(
|
||||
result=result, status_reason=status_reason, **kwargs)
|
||||
|
||||
|
||||
class Resource(object):
|
||||
|
@ -475,9 +475,8 @@ class InstancesTest(common.HeatTestCase):
|
||||
e = self.assertRaises(resource.ResourceUnknownStatus,
|
||||
instance.check_create_complete,
|
||||
(return_server, self.FakeVolumeAttach()))
|
||||
self.assertEqual(
|
||||
'Instance is not active - Unknown status BOGUS',
|
||||
six.text_type(e))
|
||||
self.assertEqual('Instance is not active - Unknown status BOGUS '
|
||||
'due to "Unknown"', six.text_type(e))
|
||||
|
||||
def test_instance_create_error_status(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
|
@ -578,8 +578,8 @@ class NeutronTest(common.HeatTestCase):
|
||||
e = self.assertRaises(
|
||||
resource.ResourceUnknownStatus,
|
||||
nr.NeutronResource.is_built, {'status': 'FROBULATING'})
|
||||
self.assertEqual(
|
||||
'Resource is not built - Unknown status FROBULATING',
|
||||
self.assertEqual('Resource is not built - Unknown status '
|
||||
'FROBULATING due to "Unknown"',
|
||||
six.text_type(e))
|
||||
|
||||
def test_resolve_attribute(self):
|
||||
|
@ -546,9 +546,8 @@ class PoolTest(common.HeatTestCase):
|
||||
self.m.ReplayAll()
|
||||
error = self.assertRaises(exception.ResourceFailure,
|
||||
scheduler.TaskRunner(rsrc.create))
|
||||
self.assertEqual(
|
||||
'ResourceUnknownStatus: Pool creation failed due to vip - '
|
||||
'Unknown status SOMETHING',
|
||||
self.assertEqual('ResourceUnknownStatus: Pool creation failed due to '
|
||||
'vip - Unknown status SOMETHING due to "Unknown"',
|
||||
six.text_type(error))
|
||||
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
|
||||
self.m.VerifyAll()
|
||||
|
@ -585,7 +585,9 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
||||
remote_stack_id = rsrc.resource_id
|
||||
error = self.assertRaises(exception.ResourceFailure,
|
||||
scheduler.TaskRunner(rsrc.delete))
|
||||
error_msg = _('ResourceUnknownStatus: Resource failed - Unknown '
|
||||
'status UPDATE_COMPLETE')
|
||||
reason = ('Resource action mismatch detected: expected=DELETE '
|
||||
'actual=UPDATE')
|
||||
error_msg = ('ResourceUnknownStatus: Resource failed - Unknown '
|
||||
'status UPDATE_COMPLETE due to "%s"') % reason
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.heat.stacks.delete.assert_called_with(stack_id=remote_stack_id)
|
||||
|
@ -494,9 +494,8 @@ class ServersTest(common.HeatTestCase):
|
||||
e = self.assertRaises(resource.ResourceUnknownStatus,
|
||||
server.check_create_complete,
|
||||
return_server)
|
||||
self.assertEqual(
|
||||
'Server is not active - Unknown status BOGUS',
|
||||
six.text_type(e))
|
||||
self.assertEqual('Server is not active - Unknown status BOGUS due to '
|
||||
'"Unknown"', six.text_type(e))
|
||||
|
||||
def test_server_create_error_status(self):
|
||||
return_server = self.fc.servers.list()[1]
|
||||
|
Loading…
Reference in New Issue
Block a user