]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix database clear when table does not exist
authorGary Kotton <gkotton@redhat.com>
Sat, 20 Oct 2012 01:41:29 +0000 (01:41 +0000)
committerGary Kotton <gkotton@redhat.com>
Sat, 20 Oct 2012 01:41:29 +0000 (01:41 +0000)
Problem occurs when running individual tests.

Change-Id: I5223cf0d66aa5bffeb304dda19c784e31a54a7c0

quantum/db/api.py

index d2bc0bd2173545176791a5d1ca0d3f5b036fd1a0..a5f5cc99e20b5007ee3d8f61f7988b713fc53561 100644 (file)
@@ -88,7 +88,10 @@ def clear_db(base=BASE):
     global _ENGINE
     assert _ENGINE
     for table in reversed(base.metadata.sorted_tables):
-        _ENGINE.execute(table.delete())
+        try:
+            _ENGINE.execute(table.delete())
+        except Exception as e:
+            LOG.info("Unable to delete table. %s.", e)
 
 
 def get_session(autocommit=True, expire_on_commit=False):