Merge "Remove old sqlalchemy-migrate workaround"
This commit is contained in:
commit
ef5351f806
@ -15,49 +15,15 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import distutils.version as dist_version
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import alembic
|
import alembic
|
||||||
from alembic import config as alembic_config
|
from alembic import config as alembic_config
|
||||||
|
|
||||||
import migrate
|
|
||||||
from migrate.versioning import util as migrate_util
|
|
||||||
import sqlalchemy
|
|
||||||
|
|
||||||
from ceilometer.openstack.common import log
|
|
||||||
|
|
||||||
|
|
||||||
INIT_VERSION = 1
|
|
||||||
LOG = log.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 nova 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 import exceptions as versioning_exceptions
|
||||||
from migrate.versioning import api as versioning_api
|
from migrate.versioning import api as versioning_api
|
||||||
from migrate.versioning.repository import Repository
|
from migrate.versioning.repository import Repository
|
||||||
|
import sqlalchemy
|
||||||
|
|
||||||
_REPOSITORY = None
|
_REPOSITORY = None
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ kombu>=2.4.8
|
|||||||
iso8601>=0.1.8
|
iso8601>=0.1.8
|
||||||
argparse
|
argparse
|
||||||
SQLAlchemy>=0.7.8,<=0.7.99
|
SQLAlchemy>=0.7.8,<=0.7.99
|
||||||
sqlalchemy-migrate>=0.7.2
|
sqlalchemy-migrate>=0.8.2
|
||||||
alembic>=0.4.1
|
alembic>=0.4.1
|
||||||
netaddr>=0.7.6
|
netaddr>=0.7.6
|
||||||
pymongo>=2.4
|
pymongo>=2.4
|
||||||
|
Loading…
Reference in New Issue
Block a user