Merge pull request #266 from ramielrowe/master

Correctly handling glance verification exception
This commit is contained in:
Andrew Melton 2014-01-03 13:06:59 -08:00
commit 19084b3ca1
2 changed files with 4 additions and 5 deletions

View File

@ -435,10 +435,6 @@ class GlanceVerifierTestCase(StacktachBaseTestCase):
self.assertTrue(verified)
def test_verify_exist_marks_exist_failed_if_field_mismatch_exception(self):
mock_logger = self._setup_mock_logger()
self.mox.StubOutWithMock(mock_logger, 'info')
mock_logger.exception("glance: Expected field to be 'expected' "
"got 'actual'")
exist1 = self.mox.CreateMockAnything()
exist2 = self.mox.CreateMockAnything()
@ -450,7 +446,7 @@ class GlanceVerifierTestCase(StacktachBaseTestCase):
field_mismatch_exc = FieldMismatch('field', 'expected', 'actual')
glance_verifier._verify_for_usage(exist1).AndRaise(
exception=field_mismatch_exc)
exist1.mark_failed(reason='FieldMismatch')
exist1.mark_failed(reason="Expected field to be 'expected' got 'actual'")
glance_verifier._verify_for_usage(exist2)
glance_verifier._verify_for_delete(exist2)

View File

@ -136,6 +136,9 @@ def _verify(exists):
_verify_validity(exist)
exist.mark_verified()
except VerificationException, e:
verified = False
exist.mark_failed(reason=str(e))
except Exception, e:
verified = False
exist.mark_failed(reason=e.__class__.__name__)