Merge "Change oslo.db to oslo_db"
This commit is contained in:
commit
72669797a3
|
@ -22,10 +22,10 @@ import contextlib
|
|||
import functools
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exception
|
||||
from oslo.db import options as db_options
|
||||
from oslo.db.sqlalchemy import models
|
||||
from oslo.db.sqlalchemy import session as db_session
|
||||
from oslo_db import exception as db_exception
|
||||
from oslo_db import options as db_options
|
||||
from oslo_db.sqlalchemy import models
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
import sqlalchemy as sql
|
||||
|
@ -401,7 +401,7 @@ def handle_conflicts(conflict_type='object'):
|
|||
details=_('Duplicate Entry'))
|
||||
except db_exception.DBError as e:
|
||||
# TODO(blk-u): inspecting inner_exception breaks encapsulation;
|
||||
# oslo.db should provide exception we need.
|
||||
# oslo_db should provide exception we need.
|
||||
if isinstance(e.inner_exception, IntegrityError):
|
||||
# LOG the exception for debug purposes, do not send the
|
||||
# exception details out with the raised Conflict exception
|
||||
|
|
|
@ -19,7 +19,7 @@ import sys
|
|||
|
||||
import migrate
|
||||
from migrate import exceptions
|
||||
from oslo.db.sqlalchemy import migration
|
||||
from oslo_db.sqlalchemy import migration
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.db.sqlalchemy import utils
|
||||
from oslo_db.sqlalchemy import utils
|
||||
import sqlalchemy as sql
|
||||
|
||||
|
||||
|
|
|
@ -399,8 +399,10 @@ class CheckForLoggingIssues(BaseASTChecker):
|
|||
|
||||
def check_oslo_namespace_imports(logical_line, blank_before, filename):
|
||||
oslo_namespace_imports = re.compile(
|
||||
r"(((from)|(import))\s+oslo\.((messaging)|(serialization)|(utils)))|"
|
||||
"(from\s+oslo\s+import\s+((messaging)|(serialization)|(utils)))")
|
||||
r"(((from)|(import))\s+oslo\.("
|
||||
"(db)|(messaging)|(serialization)|(utils)))|"
|
||||
"(from\s+oslo\s+import\s+("
|
||||
"(db)|(messaging)|(serialization)|(utils)))")
|
||||
|
||||
if re.match(oslo_namespace_imports, logical_line):
|
||||
msg = ("K333: '%s' must be used instead of '%s'.") % (
|
||||
|
|
|
@ -16,8 +16,8 @@ import os
|
|||
import shutil
|
||||
|
||||
import fixtures
|
||||
from oslo.db import options as db_options
|
||||
from oslo.db.sqlalchemy import migration
|
||||
from oslo_db import options as db_options
|
||||
from oslo_db.sqlalchemy import migration
|
||||
|
||||
from keystone.common import sql
|
||||
from keystone.common.sql import migration_helpers
|
||||
|
|
|
@ -204,6 +204,14 @@ class HackingCode(fixtures.Fixture):
|
|||
from oslo import messaging
|
||||
from oslo.messaging import conffixture
|
||||
from oslo_messaging import conffixture
|
||||
|
||||
import oslo.db
|
||||
import oslo_db
|
||||
import oslo.db.api
|
||||
import oslo_db.api
|
||||
from oslo import db
|
||||
from oslo.db import api
|
||||
from oslo_db import api
|
||||
""",
|
||||
'expected_errors': [
|
||||
(1, 0, 'K333'),
|
||||
|
@ -218,6 +226,10 @@ class HackingCode(fixtures.Fixture):
|
|||
(19, 0, 'K333'),
|
||||
(21, 0, 'K333'),
|
||||
(22, 0, 'K333'),
|
||||
(25, 0, 'K333'),
|
||||
(27, 0, 'K333'),
|
||||
(29, 0, 'K333'),
|
||||
(30, 0, 'K333'),
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ import functools
|
|||
import uuid
|
||||
|
||||
import mock
|
||||
from oslo.db import exception as db_exception
|
||||
from oslo.db import options
|
||||
from oslo_db import exception as db_exception
|
||||
from oslo_db import options
|
||||
import sqlalchemy
|
||||
from sqlalchemy import exc
|
||||
from testtools import matchers
|
||||
|
|
|
@ -29,7 +29,7 @@ WARNING::
|
|||
all data will be lost.
|
||||
"""
|
||||
|
||||
from oslo.db.sqlalchemy import utils
|
||||
from oslo_db.sqlalchemy import utils
|
||||
|
||||
from keystone.contrib import endpoint_filter
|
||||
from keystone.contrib import endpoint_policy
|
||||
|
|
|
@ -34,9 +34,9 @@ import json
|
|||
import uuid
|
||||
|
||||
from migrate.versioning import api as versioning_api
|
||||
from oslo.db import exception as db_exception
|
||||
from oslo.db.sqlalchemy import migration
|
||||
from oslo.db.sqlalchemy import session as db_session
|
||||
from oslo_db import exception as db_exception
|
||||
from oslo_db.sqlalchemy import migration
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
import six
|
||||
from sqlalchemy.engine import reflection
|
||||
import sqlalchemy.exc
|
||||
|
@ -1234,11 +1234,11 @@ class SqlUpgradeTests(SqlMigrateBase):
|
|||
self.assertEqual(1, session.query(region_unique_table).count())
|
||||
# verify the unique constraint is enforced
|
||||
self.assertRaises(
|
||||
# FIXME (I159): Since oslo.db wraps all the database exceptions
|
||||
# FIXME (I159): Since oslo_db wraps all the database exceptions
|
||||
# into more specific exception objects, we should catch both of
|
||||
# sqlalchemy and oslo.db exceptions. If an old oslo.db version
|
||||
# sqlalchemy and oslo_db exceptions. If an old oslo_db version
|
||||
# is installed, IntegrityError is raised. If >=0.4.0 version of
|
||||
# oslo.db is installed, DBError is raised.
|
||||
# oslo_db is installed, DBError is raised.
|
||||
# When the global requirements is updated with
|
||||
# the version fixes exceptions wrapping, IntegrityError must be
|
||||
# removed from the tuple.
|
||||
|
|
|
@ -117,7 +117,7 @@ class Trust(trust.Driver):
|
|||
raise exception.TrustUseLimitReached(trust_id=trust_id)
|
||||
# NOTE(morganfainberg): Ensure we have a yield point for eventlet
|
||||
# here. This should cost us nothing otherwise. This can be removed
|
||||
# if/when oslo.db cleanly handles yields on db calls.
|
||||
# if/when oslo_db cleanly handles yields on db calls.
|
||||
time.sleep(0)
|
||||
else:
|
||||
# NOTE(morganfainberg): In the case the for loop is not prematurely
|
||||
|
|
Loading…
Reference in New Issue