Move oslo.db to oslo_db namespace
This is the second in a series of changes to move to using the new oslo_<library> namespace that is being used for oslo libraries. There is currently a shim in place that is allowing the old oslo.<library> imports to work, but we need to be prepared for when the shims go away. Thus, we need patches like this one to move to the new namespace. This patch also updates our hacking check to ensure that no instances of oslo.db sneak back in. Change-Id: Ibebed114a362e199e03c83d7d229841e8f88932b
This commit is contained in:
parent
5304fa2195
commit
52953b2dcd
@ -62,8 +62,8 @@ import warnings
|
||||
warnings.simplefilter('once', DeprecationWarning)
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db.sqlalchemy import migration
|
||||
from oslo import messaging
|
||||
from oslo_db.sqlalchemy import migration
|
||||
|
||||
from cinder import i18n
|
||||
i18n.enable_lazy()
|
||||
|
@ -42,8 +42,8 @@ these objects be simple dictionaries.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db import concurrency as db_concurrency
|
||||
from oslo.db import options as db_options
|
||||
from oslo_db import concurrency as db_concurrency
|
||||
from oslo_db import options as db_options
|
||||
|
||||
|
||||
db_opts = [
|
||||
|
@ -20,7 +20,7 @@ import os
|
||||
import threading
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo import db
|
||||
from oslo_db import options
|
||||
from stevedore import driver
|
||||
|
||||
from cinder.db.sqlalchemy import api as db_api
|
||||
@ -30,7 +30,7 @@ INIT_VERSION = 000
|
||||
_IMPL = None
|
||||
_LOCK = threading.Lock()
|
||||
|
||||
db.options.set_defaults(cfg.CONF)
|
||||
options.set_defaults(cfg.CONF)
|
||||
|
||||
MIGRATE_REPO_PATH = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
|
@ -27,10 +27,10 @@ import uuid
|
||||
import warnings
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo.db import options
|
||||
from oslo.db.sqlalchemy import session as db_session
|
||||
from oslo.utils import timeutils
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db import options
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
import osprofiler.sqlalchemy
|
||||
import six
|
||||
import sqlalchemy
|
||||
|
@ -20,8 +20,8 @@ SQLAlchemy models for cinder data.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db.sqlalchemy import models
|
||||
from oslo.utils import timeutils
|
||||
from oslo_db.sqlalchemy import models
|
||||
from sqlalchemy import Column, Integer, String, Text, schema
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import ForeignKey, DateTime, Boolean
|
||||
|
@ -43,7 +43,7 @@ no_audit_log = re.compile(r"(.)*LOG\.audit(.)*")
|
||||
|
||||
# NOTE(jsbryant): When other oslo libraries switch over non-namespaced
|
||||
# imports, we will need to add them to the regex below.
|
||||
oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](concurrency)")
|
||||
oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](concurrency|db)")
|
||||
|
||||
|
||||
def no_vi_headers(physical_line, line_number, lines):
|
||||
|
@ -23,10 +23,10 @@ import os
|
||||
import random
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo import messaging
|
||||
from oslo.utils import importutils
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_db import exception as db_exc
|
||||
import osprofiler.notifier
|
||||
from osprofiler import profiler
|
||||
import osprofiler.web
|
||||
|
@ -337,7 +337,7 @@ class TestCinderManageCmd(test.TestCase):
|
||||
db_cmds.sync(version=version)
|
||||
db_sync.assert_called_once_with(version)
|
||||
|
||||
@mock.patch('oslo.db.sqlalchemy.migration.db_version')
|
||||
@mock.patch('oslo_db.sqlalchemy.migration.db_version')
|
||||
def test_db_commands_version(self, db_version):
|
||||
db_cmds = cinder_manage.DbCommands()
|
||||
db_cmds.version()
|
||||
|
@ -116,3 +116,7 @@ class HackingTestCase(test.TestCase):
|
||||
"from oslo.concurrency import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_concurrency import bar"))))
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.db import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_db import bar"))))
|
||||
|
@ -24,9 +24,9 @@ import uuid
|
||||
|
||||
from migrate.versioning import api as migration_api
|
||||
from migrate.versioning import repository
|
||||
from oslo.db.sqlalchemy import test_base
|
||||
from oslo.db.sqlalchemy import test_migrations
|
||||
from oslo.db.sqlalchemy import utils as db_utils
|
||||
from oslo_db.sqlalchemy import test_base
|
||||
from oslo_db.sqlalchemy import test_migrations
|
||||
from oslo_db.sqlalchemy import utils as db_utils
|
||||
import sqlalchemy
|
||||
|
||||
from cinder.db import migration
|
||||
|
@ -19,7 +19,7 @@ Unit Tests for qos specs internal API
|
||||
|
||||
import time
|
||||
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo_db import exception as db_exc
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
|
@ -23,8 +23,8 @@ Unit Tests for remote procedure calls using queue
|
||||
import mock
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_db import exception as db_exc
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo_db import exception as db_exc
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo_db import exception as db_exc
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
|
Loading…
x
Reference in New Issue
Block a user