Remove reliance on import order of oslo.db mods

This change fixes a couple of import statements that rely on some import
order and a bit of magic to make the oslo.db.options module visible
under the oslo.db package without importing it explicitly.

The old version of the imports relies on Python's import machinery to
attach sub-modules to packages after import (see
http://paste.openstack.org/show/148711/). It is safer to explicitly
import the module we need, to ensure that we are not relying on
side-effects of importing other modules to configure global state for
the application.

Change-Id: Ia2772030915061ff373e7b7dc77f161146b56e59
This commit is contained in:
Doug Hellmann 2014-12-10 09:39:00 -05:00
parent f8b6149079
commit d4371c5dff
2 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@
import threading
from oslo.config import cfg
from oslo import db
from oslo.db import options as db_options
from stevedore import driver
from glance.db.sqlalchemy import api as db_api
@ -31,7 +31,7 @@ from glance.db.sqlalchemy import api as db_api
_IMPL = None
_LOCK = threading.Lock()
db.options.set_defaults(cfg.CONF)
db_options.set_defaults(cfg.CONF)
def get_backend():

View File

@ -23,7 +23,7 @@ import os
import threading
from oslo.config import cfg
from oslo import db
from oslo.db import options as db_options
from stevedore import driver
from glance.db.sqlalchemy import api as db_api
@ -32,7 +32,7 @@ from glance.db.sqlalchemy import api as db_api
_IMPL = None
_LOCK = threading.Lock()
db.options.set_defaults(cfg.CONF)
db_options.set_defaults(cfg.CONF)
def get_backend():