From d4371c5dff0620c7a903ba2d1b060c70b2276992 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 10 Dec 2014 09:39:00 -0500 Subject: [PATCH] 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 --- glance/db/metadata.py | 4 ++-- glance/db/migration.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glance/db/metadata.py b/glance/db/metadata.py index 1b10fa67fe..7d288a1d8b 100644 --- a/glance/db/metadata.py +++ b/glance/db/metadata.py @@ -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(): diff --git a/glance/db/migration.py b/glance/db/migration.py index 89b70313a8..3e50d93970 100644 --- a/glance/db/migration.py +++ b/glance/db/migration.py @@ -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():