Replace DbMigrationError with DBMigrationError

because DbMigrationError is deprecated

Change-Id: I9fb20315c8451c590bce00167e9bd4c0c176b3aa
This commit is contained in:
Yaguo Zhou 2017-09-05 23:13:12 +08:00
parent fe87d28422
commit 40653eac50
4 changed files with 7 additions and 7 deletions

View File

@ -458,7 +458,7 @@ class DbSync(BaseApp):
status = 0
try:
expand_version = upgrades.get_db_version(repo='expand_repo')
except migration.exception.DbMigrationError:
except migration.exception.DBMigrationError:
LOG.info('Your database is not currently under version '
'control or the database is already controlled. Your '
'first step is to run `keystone-manage db_sync '
@ -467,11 +467,11 @@ class DbSync(BaseApp):
try:
migrate_version = upgrades.get_db_version(
repo='data_migration_repo')
except migration.exception.DbMigrationError:
except migration.exception.DBMigrationError:
migrate_version = 0
try:
contract_version = upgrades.get_db_version(repo='contract_repo')
except migration.exception.DbMigrationError:
except migration.exception.DBMigrationError:
contract_version = 0
repo = migrate.versioning.repository.Repository(

View File

@ -179,7 +179,7 @@ def _sync_repo(repo_name):
# an exception that we can safely ignore
try:
migration.db_version_control(engine, abs_path)
except (migration.exception.DbMigrationError,
except (migration.exception.DBMigrationError,
exceptions.DatabaseAlreadyControlledError): # nosec
pass
init_version = get_init_version(abs_path=abs_path)
@ -214,7 +214,7 @@ def _assert_not_schema_downgrade(version=None):
try:
current_ver = int(six.text_type(get_db_version()))
if int(version) < current_ver:
raise migration.exception.DbMigrationError(
raise migration.exception.DBMigrationError(
_("Unable to downgrade schema"))
except exceptions.DatabaseNotControlledError: # nosec
# NOTE(morganfainberg): The database is not controlled, this action

View File

@ -682,7 +682,7 @@ class CliDBSyncTestCase(unit.BaseTestCase):
@mock.patch('keystone.cmd.cli.upgrades.get_db_version')
def test_db_sync_check_when_database_is_empty(self, mocked_get_db_version):
e = migration.exception.DbMigrationError("Invalid version")
e = migration.exception.DBMigrationError("Invalid version")
mocked_get_db_version.side_effect = e
checker = cli.DbSync()

View File

@ -1600,7 +1600,7 @@ class VersionTests(SqlMigrateBase):
def test_assert_not_schema_downgrade(self):
self.upgrade()
self.assertRaises(
db_exception.DbMigrationError,
db_exception.DBMigrationError,
upgrades._sync_common_repo,
self.repos[LEGACY_REPO].max_version - 1)