summaryrefslogtreecommitdiff
path: root/oslo_db/sqlalchemy
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-05-10 17:51:42 +0000
committerGerrit Code Review <review@openstack.org>2016-05-10 17:51:42 +0000
commitcb9644d21c7e70ac376cc7e40a56096004072780 (patch)
treef9ec3f399bdf50dc92bd855dae36b329fb38573f /oslo_db/sqlalchemy
parent6369fe8026a264c6c93fda46f0905216d495e0c2 (diff)
parent08f49111e448b1cd81d12814ce1cb467af5a2c0b (diff)
downloadoslo-db-cb9644d21c7e70ac376cc7e40a56096004072780.tar.gz
Merge "Raise DbMigrationError for invalid version"
Diffstat (limited to 'oslo_db/sqlalchemy')
-rw-r--r--oslo_db/sqlalchemy/migration.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/migration.py b/oslo_db/sqlalchemy/migration.py
index 7799552..c85fd22 100644
--- a/oslo_db/sqlalchemy/migration.py
+++ b/oslo_db/sqlalchemy/migration.py
@@ -150,7 +150,14 @@ def db_version_control(engine, abs_path, version=None):
:param version: Initial database version
"""
repository = _find_migrate_repo(abs_path)
- versioning_api.version_control(engine, repository, version)
+
+ try:
+ versioning_api.version_control(engine, repository, version)
+ except versioning_exceptions.InvalidVersionError as ex:
+ raise exception.DbMigrationError("Invalid version : %s" % ex)
+ except versioning_exceptions.DatabaseAlreadyControlledError:
+ raise exception.DbMigrationError("Database is already controlled.")
+
return version