Merge "Use EntityNotFound instead of VolumeNotFound"

This commit is contained in:
Jenkins 2015-06-03 10:43:40 +00:00 committed by Gerrit Code Review
commit 0f6eb8bdb1
4 changed files with 5 additions and 9 deletions

View File

@ -231,10 +231,6 @@ class EntityNotFound(HeatException):
msg_fmt = _("The %(entity)s (%(name)s) could not be found.")
class VolumeNotFound(HeatException):
msg_fmt = _("The Volume (%(volume)s) could not be found.")
class VolumeSnapshotNotFound(HeatException):
msg_fmt = _("The VolumeSnapshot (%(snapshot)s) could not be found.")

View File

@ -93,7 +93,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin):
except exceptions.NotFound as ex:
LOG.info(_LI('Volume (%(volume)s) not found: %(ex)s'),
{'volume': volume, 'ex': ex})
raise exception.VolumeNotFound(volume=volume)
raise exception.EntityNotFound(entity='Volume', name=volume)
def get_volume_snapshot(self, snapshot):
try:
@ -212,7 +212,7 @@ class VolumeResizeProgress(object):
class VolumeConstraint(constraints.BaseCustomConstraint):
expected_exceptions = (exception.VolumeNotFound,)
expected_exceptions = (exception.EntityNotFound,)
def validate_with_client(self, client, volume):
client.client_plugin('cinder').get_volume(volume)

View File

@ -222,7 +222,7 @@ class InstancesTest(common.HeatTestCase):
nova.NovaClientPlugin._create().MultipleTimes().AndReturn(self.fc)
self.stub_SnapshotConstraint_validate()
self.m.StubOutWithMock(cinder.CinderClientPlugin, 'get_volume')
ex = exception.VolumeNotFound(volume='1234')
ex = exception.EntityNotFound(entity='Volume', name='1234')
cinder.CinderClientPlugin.get_volume('1234').AndRaise(ex)
self.m.ReplayAll()

View File

@ -71,8 +71,8 @@ class VolumeConstraintTest(common.HeatTestCase):
self.assertTrue(self.constraint.validate("foo", self.ctx))
def test_validation_error(self):
self.mock_get_volume.side_effect = exception.VolumeNotFound(
volume='bar')
self.mock_get_volume.side_effect = exception.EntityNotFound(
entity='Volume', name='bar')
self.assertFalse(self.constraint.validate("bar", self.ctx))