From 2a8485a296f87bdb70583ff40f856b56b054086b Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 2 Dec 2013 19:14:43 -0500 Subject: [PATCH] Bump to sqlalchemy-migrate 0.8.2 This allows us to drop some unsightly sqlalchemy-migrate 0.7.3 patching. The related requirements change is here: Icde6248ca102884323d7912bab0f4a716aa294ec Change-Id: I5f80dfc07f8256716d025002fc1a1f47e58b2142 --- cinder/db/sqlalchemy/migration.py | 39 +++---------------------------- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/cinder/db/sqlalchemy/migration.py b/cinder/db/sqlalchemy/migration.py index ed4ca87e25d..ebbb345804d 100644 --- a/cinder/db/sqlalchemy/migration.py +++ b/cinder/db/sqlalchemy/migration.py @@ -19,48 +19,15 @@ import os -import distutils.version as dist_version -import migrate -from migrate.versioning import util as migrate_util +from migrate import exceptions as versioning_exceptions +from migrate.versioning import api as versioning_api +from migrate.versioning.repository import Repository import sqlalchemy from cinder.db.sqlalchemy.api import get_engine from cinder import exception -from cinder.openstack.common import log as logging - INIT_VERSION = 000 -LOG = logging.getLogger(__name__) - - -@migrate_util.decorator -def patched_with_engine(f, *a, **kw): - url = a[0] - engine = migrate_util.construct_engine(url, **kw) - - try: - kw['engine'] = engine - return f(*a, **kw) - finally: - if isinstance(engine, migrate_util.Engine) and engine is not url: - migrate_util.log.debug('Disposing SQLAlchemy engine %s', engine) - engine.dispose() - - -# TODO(jkoelker) When migrate 0.7.3 is released and cinder depends -# on that version or higher, this can be removed -MIN_PKG_VERSION = dist_version.StrictVersion('0.7.3') -if (not hasattr(migrate, '__version__') or - dist_version.StrictVersion(migrate.__version__) < MIN_PKG_VERSION): - migrate_util.with_engine = patched_with_engine - - -# NOTE(jkoelker) Delay importing migrate until we are patched -from migrate import exceptions as versioning_exceptions -from migrate.versioning import api as versioning_api -from migrate.versioning.repository import Repository - - _REPOSITORY = None diff --git a/requirements.txt b/requirements.txt index 0723d0f59e6..d029aaea81e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ Routes>=1.12.3 rtslib-fb>=2.1.39 six>=1.4.1 SQLAlchemy>=0.7.8,<=0.7.99 -sqlalchemy-migrate>=0.7.2 +sqlalchemy-migrate>=0.8.2 stevedore>=0.10 suds>=0.4 WebOb>=1.2.3,<1.3