Move oslo.config to oslo_config namespace

This is the third 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.config sneak back in.

Change-Id: I45d24c4330f7c23fc5ad0a0527f1840d09710512
This commit is contained in:
Jay S. Bryant 2015-01-15 14:03:49 -06:00
parent fea2bae001
commit 6a2df86bba
197 changed files with 209 additions and 204 deletions

View File

@ -15,7 +15,7 @@
# under the License.
from oslo.config import cfg
from oslo_config import cfg
import paste.urlmap
from cinder.i18n import _LW

View File

@ -18,7 +18,7 @@ import os
import re
import urllib
from oslo.config import cfg
from oslo_config import cfg
import six.moves.urllib.parse as urlparse
import webob

View File

@ -19,7 +19,7 @@ It can't be called 'extensions' because that causes namespacing problems.
"""
from oslo.config import cfg
from oslo_config import cfg
from cinder.api import extensions
from cinder.openstack.common import log as logging

View File

@ -17,8 +17,8 @@
from xml.parsers import expat
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
import webob.exc
from cinder.api import extensions

View File

@ -14,8 +14,8 @@
# under the License.
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
import webob.exc
from cinder.api import extensions

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from webob import exc
from cinder.api import extensions

View File

@ -16,8 +16,8 @@
import os
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
import webob.dec
import webob.exc

View File

@ -20,8 +20,8 @@ Common Auth Middleware.
import os
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob.dec
import webob.exc

View File

@ -17,7 +17,7 @@ Request Body limiting middleware.
"""
from oslo.config import cfg
from oslo_config import cfg
import webob.dec
import webob.exc

View File

@ -17,7 +17,7 @@
import datetime
from lxml import etree
from oslo.config import cfg
from oslo_config import cfg
from cinder.api.openstack import wsgi
from cinder.api.views import versions as views_versions

View File

@ -19,8 +19,8 @@ Handles all requests relating to the volume backups service.
from eventlet import greenthread
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from cinder.backup import rpcapi as backup_rpcapi
from cinder import context

View File

@ -17,8 +17,8 @@
import abc
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import six
from cinder.db import base

View File

@ -49,10 +49,10 @@ import subprocess
import time
import eventlet
from oslo.config import cfg
from oslo.utils import encodeutils
from oslo.utils import excutils
from oslo.utils import units
from oslo_config import cfg
from cinder.backup.driver import BackupDriver
from cinder import exception

View File

@ -37,10 +37,10 @@ import os
import socket
import eventlet
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import timeutils
from oslo.utils import units
from oslo_config import cfg
import six
from swiftclient import client as swift

View File

@ -29,8 +29,8 @@ import json
import os
import stat
from oslo.config import cfg
from oslo_concurrency import processutils
from oslo_config import cfg
from cinder.backup.driver import BackupDriver
from cinder import exception

View File

@ -33,10 +33,10 @@ Volume backups can be created, restored, deleted and listed.
"""
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import importutils
from oslo_config import cfg
from cinder.backup import driver
from cinder.backup import rpcapi as backup_rpcapi

View File

@ -18,8 +18,8 @@ Client side of the volume backup RPC API.
"""
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
from cinder.openstack.common import log as logging
from cinder import rpc
@ -96,4 +96,4 @@ class BackupAPI(object):
'host': host})
cctxt = self.client.prepare(server=host)
return cctxt.cast(ctxt, 'reset_status', backup_id=backup_id,
status=status)
status=status)

View File

@ -33,7 +33,7 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo.config import cfg
from oslo_config import cfg
from cinder import i18n
i18n.enable_lazy()

View File

@ -25,7 +25,7 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo.config import cfg
from oslo_config import cfg
from cinder import i18n
i18n.enable_lazy()

View File

@ -23,7 +23,7 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
import eventlet
from oslo.config import cfg
from oslo_config import cfg
eventlet.monkey_patch()

View File

@ -61,8 +61,8 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
from oslo_db.sqlalchemy import migration
from cinder import i18n

View File

@ -25,7 +25,7 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo.config import cfg
from oslo_config import cfg
from cinder import i18n
i18n.enable_lazy()

View File

@ -33,7 +33,7 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo.config import cfg
from oslo_config import cfg
from cinder import i18n
i18n.enable_lazy()

View File

@ -41,7 +41,7 @@ import warnings
warnings.simplefilter('once', DeprecationWarning)
from oslo.config import cfg
from oslo_config import cfg
from cinder import i18n
i18n.enable_lazy()

View File

@ -27,7 +27,7 @@ stepping stone.
import socket
from oslo.config import cfg
from oslo_config import cfg
from cinder.i18n import _

View File

@ -23,7 +23,7 @@ from novaclient import service_catalog
from novaclient.v1_1 import client as nova_client
from novaclient.v1_1.contrib import assisted_volume_snapshots
from novaclient.v1_1.contrib import list_extensions
from oslo.config import cfg
from oslo_config import cfg
from requests import exceptions as request_exceptions
from cinder import context as ctx

View File

@ -20,9 +20,9 @@ Handles all requests relating to consistency groups.
import functools
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import timeutils
from oslo_config import cfg
from cinder.db import base
from cinder import exception

View File

@ -41,7 +41,7 @@ these objects be simple dictionaries.
"""
from oslo.config import cfg
from oslo_config import cfg
from oslo_db import concurrency as db_concurrency
from oslo_db import options as db_options

View File

@ -17,8 +17,8 @@
"""Base class for classes that need modular database access."""
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
db_driver_opt = cfg.StrOpt('db_driver',

View File

@ -19,7 +19,7 @@
import os
import threading
from oslo.config import cfg
from oslo_config import cfg
from oslo_db import options
from stevedore import driver

View File

@ -26,8 +26,8 @@ import time
import uuid
import warnings
from oslo.config import cfg
from oslo.utils import timeutils
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

View File

@ -14,7 +14,7 @@
import datetime
from oslo.config import cfg
from oslo_config import cfg
from sqlalchemy import MetaData, Table
from cinder.i18n import _LE, _LI

View File

@ -14,7 +14,7 @@
import datetime
from oslo.config import cfg
from oslo_config import cfg
from sqlalchemy import MetaData, Table
from cinder.i18n import _

View File

@ -19,8 +19,8 @@
SQLAlchemy models for cinder data.
"""
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_db.sqlalchemy import models
from sqlalchemy import Column, Integer, String, Text, schema
from sqlalchemy.ext.declarative import declarative_base

View File

@ -24,7 +24,7 @@ SHOULD include dedicated exception logging.
import sys
from oslo.config import cfg
from oslo_config import cfg
import six
import webob.exc

View File

@ -43,7 +43,8 @@ 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|db)")
oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](concurrency|db"
"|config)")
def no_vi_headers(physical_line, line_number, lines):

View File

@ -27,9 +27,9 @@ import sys
import time
import glanceclient.exc
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_config import cfg
import six.moves.urllib.parse as urlparse
from cinder import exception

View File

@ -28,10 +28,10 @@ import contextlib
import os
import tempfile
from oslo.config import cfg
from oslo.utils import timeutils
from oslo.utils import units
from oslo_concurrency import processutils
from oslo_config import cfg
from cinder import exception
from cinder.i18n import _

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
keymgr_opts = [
cfg.StrOpt('api_class',

View File

@ -24,8 +24,8 @@ import binascii
from barbicanclient import client as barbican_client
from keystoneclient.auth import identity
from keystoneclient import session
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from cinder import exception
from cinder.i18n import _, _LE

View File

@ -33,7 +33,7 @@ encryption key so *any* volume can be decrypted once the fixed key is known.
import array
from oslo.config import cfg
from oslo_config import cfg
from cinder import exception
from cinder.i18n import _, _LW

View File

@ -19,7 +19,7 @@ Key manager API
import abc
from oslo.config import cfg
from oslo_config import cfg
import six
encryption_opts = [

View File

@ -52,8 +52,8 @@ This module provides Manager, a base class for managers.
"""
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
from cinder.db import base
from cinder.openstack.common import log as logging

View File

@ -16,7 +16,7 @@
"""Policy Engine For Cinder"""
from oslo.config import cfg
from oslo_config import cfg
from cinder import exception
from cinder.openstack.common import policy

View File

@ -19,9 +19,9 @@
import datetime
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_config import cfg
from cinder import context
from cinder import db

View File

@ -13,8 +13,8 @@
# under the License.
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -17,7 +17,7 @@ Handles all requests relating to volume replication.
"""
import functools
from oslo.config import cfg
from oslo_config import cfg
from cinder.db import base
from cinder import exception

View File

@ -26,9 +26,9 @@ __all__ = [
'TRANSPORT_ALIASES',
]
from oslo.config import cfg
from oslo import messaging
from oslo.serialization import jsonutils
from oslo_config import cfg
from osprofiler import profiler
import cinder.context

View File

@ -19,9 +19,9 @@
Scheduler base class that all Schedulers should inherit from
"""
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_config import cfg
from cinder import db
from cinder.i18n import _

View File

@ -20,7 +20,7 @@ You can customize this scheduler by specifying your own volume Filters and
Weighing Functions.
"""
from oslo.config import cfg
from oslo_config import cfg
from cinder import exception
from cinder.i18n import _, _LW

View File

@ -19,8 +19,8 @@ Manage hosts in the current zone.
import UserDict
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from cinder import db
from cinder import exception

View File

@ -19,10 +19,10 @@
Scheduler Service
"""
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import importutils
from oslo_config import cfg
from cinder import context
from cinder import db

View File

@ -16,9 +16,9 @@
Client side of the scheduler manager RPC API.
"""
from oslo.config import cfg
from oslo import messaging
from oslo.serialization import jsonutils
from oslo_config import cfg
from cinder import rpc

View File

@ -24,8 +24,8 @@ import datetime
import json
import os
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from cinder.i18n import _LE
from cinder.openstack.common import log as logging

View File

@ -50,7 +50,7 @@ With that, FilterScheduler behaves mostly the same as Chance/SimpleScheduler,
with additional benefits of supporting volume types, volume encryption, QoS.
"""
from oslo.config import cfg
from oslo_config import cfg
simple_scheduler_opts = [
cfg.IntOpt("max_gigabytes",

View File

@ -35,7 +35,7 @@ and the weighing has the opposite effect of the default.
import math
from oslo.config import cfg
from oslo_config import cfg
from cinder.openstack.common.scheduler import weights

View File

@ -23,7 +23,7 @@ number and the weighing has the opposite effect of the default.
"""
from oslo.config import cfg
from oslo_config import cfg
from cinder import db
from cinder.openstack.common import log as logging

View File

@ -22,10 +22,10 @@ import inspect
import os
import random
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_db import exception as db_exc
import osprofiler.notifier
from osprofiler import profiler

View File

@ -22,7 +22,7 @@ import os
import string
from eventlet import pools
from oslo.config import cfg
from oslo_config import cfg
import paramiko
from cinder import exception

View File

@ -29,12 +29,12 @@ import uuid
import fixtures
import mock
import mox
from oslo.config import cfg
from oslo.config import fixture as config_fixture
from oslo.messaging import conffixture as messaging_conffixture
from oslo.utils import strutils
from oslo.utils import timeutils
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_config import fixture as config_fixture
import stubout
import testtools

View File

@ -13,11 +13,11 @@
import ast
import fixtures
from oslo.config import cfg
from oslo.config import fixture as config_fixture
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_config import fixture as config_fixture
import webob
from webob import exc

View File

@ -17,9 +17,9 @@ import json
import uuid
import mock
from oslo.config import cfg
from oslo import messaging
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob
from cinder.api.contrib import volume_actions

View File

@ -19,7 +19,7 @@ Tests for volume replication API code.
import json
import mock
from oslo.config import cfg
from oslo_config import cfg
import webob
from cinder import context

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
import six
import webob

View File

@ -16,8 +16,8 @@
import iso8601
from lxml import etree
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob
from cinder.api import extensions

View File

@ -15,8 +15,8 @@
import uuid
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob
from cinder.api import extensions

View File

@ -15,8 +15,8 @@
import uuid
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob
from cinder.api import extensions

View File

@ -17,7 +17,7 @@ import datetime
from lxml import etree
import mock
from oslo.config import cfg
from oslo_config import cfg
import webob
from cinder.api import extensions

View File

@ -15,8 +15,8 @@
import uuid
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob
from cinder.api import extensions

View File

@ -15,8 +15,8 @@
import uuid
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
import webob
from cinder.api import extensions

View File

@ -18,7 +18,7 @@ import datetime
from lxml import etree
import mock
from oslo.config import cfg
from oslo_config import cfg
import six
import six.moves.urllib.parse as urlparse
import webob

View File

@ -16,7 +16,7 @@
import os
from oslo.config import cfg
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -14,7 +14,7 @@
"""Tests for volume name_id."""
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder import db

View File

@ -15,7 +15,7 @@
# under the License.
from oslo.config import cfg
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -18,7 +18,7 @@ import datetime
import glanceclient.exc
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder import exception

View File

@ -14,7 +14,7 @@
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from cinder.openstack.common import log as logging
from cinder.tests.integrated import integrated_helpers

View File

@ -22,7 +22,7 @@ import base64
import binascii
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import exception
from cinder.keymgr import barbican

View File

@ -19,7 +19,7 @@ Test cases for the conf key manager.
import array
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder import exception

View File

@ -15,7 +15,7 @@
# under the License.
from oslo.config import cfg
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -18,7 +18,7 @@ Tests For Allocated Capacity Weigher.
"""
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder.openstack.common.scheduler.weights import HostWeightHandler

View File

@ -17,7 +17,7 @@ Tests For Capacity Weigher.
"""
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder.openstack.common.scheduler.weights import HostWeightHandler

View File

@ -17,8 +17,8 @@ Tests For HostManager
"""
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from cinder import exception
from cinder.openstack.common.scheduler import filters

View File

@ -20,7 +20,7 @@ Unit Tests for cinder.scheduler.rpcapi
import copy
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder.scheduler import rpcapi as scheduler_rpcapi

View File

@ -19,7 +19,7 @@ Tests For Scheduler
"""
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder import db

View File

@ -17,7 +17,7 @@ Tests For Volume Number Weigher.
"""
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder.db.sqlalchemy import api

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from cinder import exception
from cinder import test

View File

@ -20,9 +20,9 @@ Tests for Backup code.
import tempfile
import mock
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_config import cfg
from cinder.backup import manager
from cinder import context

View File

@ -24,7 +24,7 @@ import tempfile
import zlib
import mock
from oslo.config import cfg
from oslo_config import cfg
from swiftclient import client as swift
from cinder.backup.drivers.swift import SwiftBackupDriver

View File

@ -14,7 +14,7 @@
# under the License.
import mock
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder.db.sqlalchemy import api

View File

@ -16,7 +16,7 @@ import StringIO
import sys
import mock
from oslo.config import cfg
from oslo_config import cfg
import rtslib
from cinder.cmd import all as cinder_all
@ -636,7 +636,7 @@ class TestCinderManageCmd(test.TestCase):
service_get_all.assert_called_with(ctxt)
service_is_up.assert_called_with(service)
@mock.patch('oslo.config.cfg.ConfigOpts.register_cli_opt')
@mock.patch('oslo_config.cfg.ConfigOpts.register_cli_opt')
def test_main_argv_lt_2(self, register_cli_opt):
script_name = 'cinder-manage'
sys.argv = [script_name]
@ -647,9 +647,9 @@ class TestCinderManageCmd(test.TestCase):
self.assertTrue(register_cli_opt.called)
self.assertEqual(exit.code, 2)
@mock.patch('oslo.config.cfg.ConfigOpts.__call__')
@mock.patch('oslo_config.cfg.ConfigOpts.__call__')
@mock.patch('cinder.openstack.common.log.setup')
@mock.patch('oslo.config.cfg.ConfigOpts.register_cli_opt')
@mock.patch('oslo_config.cfg.ConfigOpts.register_cli_opt')
def test_main_sudo_failed(self, register_cli_opt, log_setup,
config_opts_call):
script_name = 'cinder-manage'
@ -666,8 +666,8 @@ class TestCinderManageCmd(test.TestCase):
self.assertFalse(log_setup.called)
self.assertEqual(exit.code, 2)
@mock.patch('oslo.config.cfg.ConfigOpts.__call__')
@mock.patch('oslo.config.cfg.ConfigOpts.register_cli_opt')
@mock.patch('oslo_config.cfg.ConfigOpts.__call__')
@mock.patch('oslo_config.cfg.ConfigOpts.register_cli_opt')
def test_main(self, register_cli_opt, config_opts_call):
script_name = 'cinder-manage'
sys.argv = [script_name, 'config', 'list']

View File

@ -17,7 +17,7 @@
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from cinder import test

View File

@ -18,9 +18,9 @@ import math
import mock
import mox
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import units
from oslo_config import cfg
from cinder.brick.initiator import connector
from cinder import exception

View File

@ -16,7 +16,7 @@
import datetime
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder import db

View File

@ -21,9 +21,9 @@ import time
import traceback
import mock
from oslo.config import cfg
from oslo.utils import units
from oslo_concurrency import processutils as putils
from oslo_config import cfg
from cinder import brick
from cinder import compute

View File

@ -18,9 +18,9 @@ import shutil
import tempfile
import mock
from oslo.config import cfg
from oslo.utils import units
from oslo_concurrency import processutils
from oslo_config import cfg
from cinder import context
from cinder import exception

View File

@ -147,3 +147,7 @@ class HackingTestCase(test.TestCase):
"from oslo.db import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_db import bar"))))
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.config import foo"))))
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
"from oslo_config import bar"))))

View File

@ -19,8 +19,8 @@ import mock
import ast
from oslo.config import cfg
from oslo.utils import units
from oslo_config import cfg
from cinder import context
from cinder import exception

View File

@ -13,8 +13,8 @@
# under the License.
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from cinder import context
from cinder import test

View File

@ -22,7 +22,7 @@
import copy
import mox
from oslo.config import cfg
from oslo_config import cfg
from cinder import context
from cinder import exception

View File

@ -22,8 +22,8 @@ NAS based IBM GPFS Storage Systems).
"""
import mock
from oslo.config import cfg
from oslo.utils import units
from oslo_config import cfg
from cinder import context
from cinder import exception

Some files were not shown because too many files have changed in this diff Show More