Replace DbMigrationError with DBMigrationError

DbMigrationError is deprecated and will NOT be thrown in oslo.db
since oslo.db >=4.27.0, DBMigrationError will be thrown instead.
Consumers should catch DBMigrationError instead of DbMigrationError

Change-Id: I83ca5e90c6dfbf7e0820eb0fb4ca0c6a2001c652
This commit is contained in:
Yaguo Zhou 2017-09-05 23:06:53 +08:00
parent bd1887ff44
commit 72f9965fd7
2 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@ class DbCommands(object):
sys.exit(1)
try:
return db_migration.db_sync(version)
except db_exc.DbMigrationError as ex:
except db_exc.DBMigrationError as ex:
print("Error during database migration: %s" % ex)
sys.exit(1)

View File

@ -80,7 +80,7 @@ class TestKarborManageCmd(base.TestCase):
@mock.patch("oslo_db.sqlalchemy.migration.db_sync")
def test_db_commands_script_not_present(self, db_sync):
db_sync.side_effect = db_exc.DbMigrationError
db_sync.side_effect = db_exc.DBMigrationError(None)
db_cmds = karbor_manage.DbCommands()
exit = self.assertRaises(SystemExit, db_cmds.sync, 101)
self.assertEqual(1, exit.code)