Remove imports from oslo namespaces

Oslo team is recommending everyone to use the direct imports and
not use the Oslo namespaces. So switch all our code to use oslo_*
instead of "from oslo." or "import oslo" or "from oslo"

NOTE: some of the tests still have mocks referring to oslo.utils
@mock.patch('oslo.utils.timeutils.utcnow')
as the tests break otherwise. We should do this later.

Closes-bug: #1419385
Change-Id: I8e3fbeb833cddc3f55674a0e781ffe69d5033ad4
This commit is contained in:
Davanum Srinivas 2015-02-07 16:07:39 -05:00 committed by Davanum Srinivas (dims)
parent 23ec6b700d
commit 17c5711c55
57 changed files with 93 additions and 93 deletions

View File

@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.config import cfg
from oslo_config import cfg
import pecan
from magnum.api import auth

View File

@ -15,7 +15,7 @@
# under the License.
"""Access Control Lists (ACL's) control access the API server."""
from oslo.config import cfg
from oslo_config import cfg
from magnum.api.middleware import auth_token

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
from oslo_utils import strutils
import wsme
from wsme import types as wtypes

View File

@ -14,7 +14,7 @@
# under the License.
import jsonpatch
from oslo.config import cfg
from oslo_config import cfg
import wsme
from magnum.openstack.common._i18n import _

View File

@ -15,8 +15,8 @@
# under the License.
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
from pecan import hooks
from magnum.common import context

View File

@ -19,7 +19,7 @@ import os
import sys
from wsgiref import simple_server
from oslo.config import cfg
from oslo_config import cfg
from magnum.api import app as api_app
from magnum.common import service

View File

@ -18,7 +18,7 @@ import logging as std_logging
import os
import sys
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import rpc_service as service
from magnum.conductor.handlers import bay_k8s_heat

View File

@ -15,9 +15,9 @@
import os
from oslo.config import cfg
from oslo.db import options
from oslo.db.sqlalchemy.migration_cli import manager
from oslo_config import cfg
from oslo_db import options
from oslo_db.sqlalchemy.migration_cli import manager
from magnum.openstack.common import log as logging

View File

@ -13,7 +13,7 @@
# under the License.
from heatclient.v1 import client as heatclient
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import exception
from magnum.common import magnum_keystoneclient

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import rpc
from magnum import version

View File

@ -23,8 +23,8 @@ import sys
import uuid
from keystoneclient import exceptions as keystone_exceptions
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from oslo_utils import excutils
import pecan
import six
import wsme

View File

@ -16,8 +16,8 @@ import copy
import keystoneclient.exceptions as kc_exception
from keystoneclient.v3 import client as kc_v3
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
from magnum.common import context
from magnum.common import exception

View File

@ -17,7 +17,7 @@
import os
from oslo.config import cfg
from oslo_config import cfg
PATH_OPTS = [
cfg.StrOpt('pybasedir',

View File

@ -27,8 +27,8 @@ __all__ = [
'TRANSPORT_ALIASES',
]
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from magnum.common import context as magnum_context

View File

@ -15,8 +15,8 @@
"""Common RPC service and API tools for Magnum."""
import eventlet
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
import oslo_messaging as messaging
import magnum.common.context
from magnum.objects import base as objects_base

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.config import cfg
from oslo_config import cfg
from magnum.openstack.common import log as logging

View File

@ -13,7 +13,7 @@
"""Utility for fetching a resource (e.g. a manifest) from a URL."""
from oslo.config import cfg
from oslo_config import cfg
import requests
from requests import exceptions
from six.moves import urllib

View File

@ -29,9 +29,9 @@ import tempfile
import uuid
import netaddr
from oslo.config import cfg
from oslo.utils import excutils
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_utils import excutils
import paramiko
import six

View File

@ -11,7 +11,7 @@
# limitations under the License.
"""API for interfacing with Magnum Backend."""
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import rpc_service
from magnum import objects

View File

@ -15,7 +15,7 @@
"""Config options for Magnum Backend service."""
from oslo.config import cfg
from oslo_config import cfg
SERVICE_OPTS = [
cfg.StrOpt('topic',

View File

@ -14,7 +14,7 @@
from heatclient.common import template_utils
from heatclient import exc
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import clients
from magnum.common import short_id

View File

@ -14,7 +14,7 @@
from docker import client
from docker import tls
from oslo.config import cfg
from oslo_config import cfg
from magnum.openstack.common import log as logging

View File

@ -13,7 +13,7 @@
"""Magnum Docker RPC handler."""
from docker import errors
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import docker_utils
from magnum.conductor.handlers.common import docker_client

View File

@ -12,7 +12,7 @@
"""Magnum Kubernetes RPC handler."""
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import clients
from magnum.conductor.handlers.common import kube_utils

View File

@ -14,7 +14,7 @@
"""Magnum specific config handling."""
from oslo.config import cfg
from oslo_config import cfg
from magnum import version

View File

@ -19,8 +19,8 @@ Base classes for storage engines
import abc
from oslo.config import cfg
from oslo.db import api as db_api
from oslo_config import cfg
from oslo_db import api as db_api
import six

View File

@ -16,7 +16,7 @@
"""Database setup and migration commands."""
from oslo.config import cfg
from oslo_config import cfg
from stevedore import driver
_IMPL = None
@ -25,7 +25,7 @@ _IMPL = None
def get_backend():
global _IMPL
if not _IMPL:
cfg.CONF.import_opt('backend', 'oslo.db.options', group='database')
cfg.CONF.import_opt('backend', 'oslo_db.options', group='database')
_IMPL = driver.DriverManager("magnum.database.migration_backend",
cfg.CONF.database.backend).driver
return _IMPL

View File

@ -16,11 +16,11 @@
"""SQLAlchemy storage backend."""
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.db.sqlalchemy import session as db_session
from oslo.db.sqlalchemy import utils as db_utils
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import session as db_session
from oslo_db.sqlalchemy import utils as db_utils
from oslo_utils import timeutils
from sqlalchemy.orm.exc import NoResultFound
from magnum.common import exception

View File

@ -19,7 +19,7 @@ import os
import alembic
from alembic import config as alembic_config
import alembic.migration as alembic_migration
from oslo.db import exception as db_exc
from oslo_db import exception as db_exc
from magnum.db.sqlalchemy import api as sqla_api
from magnum.db.sqlalchemy import models

View File

@ -20,9 +20,9 @@ SQLAlchemy models for container service
import json
from oslo.config import cfg
from oslo.db import options as db_options
from oslo.db.sqlalchemy import models
from oslo_config import cfg
from oslo_db import options as db_options
from oslo_db.sqlalchemy import models
import six.moves.urllib.parse as urlparse
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base

View File

@ -17,8 +17,8 @@
import collections
import copy
from oslo import messaging
from oslo_context import context
import oslo_messaging as messaging
import six
from magnum.common import exception

View File

@ -19,7 +19,7 @@ import datetime
import iso8601
import netaddr
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from magnum.openstack.common._i18n import _

View File

@ -28,7 +28,7 @@ import traceback
import eventlet
import eventlet.backdoor
import greenlet
from oslo.config import cfg
from oslo_config import cfg
from magnum.openstack.common._i18n import _LI
from magnum.openstack.common import log as logging

View File

@ -38,9 +38,9 @@ import socket
import sys
import traceback
from oslo.config import cfg
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo.utils import importutils
from oslo_utils import importutils
import six
from six import moves

View File

@ -15,7 +15,7 @@ import copy
import random
import time
from oslo.config import cfg
from oslo_config import cfg
import six
from magnum.openstack.common._i18n import _, _LE, _LI

View File

@ -35,7 +35,7 @@ except ImportError:
import eventlet
from eventlet import event
from oslo.config import cfg
from oslo_config import cfg
from magnum.openstack.common import eventlet_backdoor
from magnum.openstack.common._i18n import _LE, _LI, _LW

View File

@ -13,7 +13,7 @@
import os
import unittest
from oslo.config import cfg
from oslo_config import cfg
import pecan
from pecan import testing

View File

@ -22,7 +22,7 @@
# NOTE(deva): import auth_token so we can override a config option
from keystonemiddleware import auth_token # noqa
from oslo.config import cfg
from oslo_config import cfg
import pecan
import pecan.testing
from six.moves.urllib import parse as urlparse

View File

@ -13,8 +13,8 @@
import datetime
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
@ -130,7 +130,7 @@ class TestPatch(api_base.FunctionalTest):
name='bay_example_A',
node_count=3)
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_replace_ok(self, mock_utcnow):
name = 'bay_example_B'
test_time = datetime.datetime(2000, 1, 1, 0, 0)
@ -293,7 +293,7 @@ class TestPost(api_base.FunctionalTest):
bay.create()
return bay
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_create_bay(self, mock_utcnow):
bdict = apiutils.bay_post_data()
test_time = datetime.datetime(2000, 1, 1, 0, 0)

View File

@ -13,8 +13,8 @@
import datetime
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
@ -138,7 +138,7 @@ class TestPatch(api_base.FunctionalTest):
self.assertEqual('application/json', response.content_type)
self.assertTrue(response.json['error_message'])
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_replace_singular(self, mock_utcnow):
name = 'bay_model_example_B'
test_time = datetime.datetime(2000, 1, 1, 0, 0)
@ -249,7 +249,7 @@ class TestPost(api_base.FunctionalTest):
def setUp(self):
super(TestPost, self).setUp()
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_create_baymodel(self, mock_utcnow):
cdict = apiutils.baymodel_post_data()
test_time = datetime.datetime(2000, 1, 1, 0, 0)

View File

@ -13,8 +13,8 @@
import datetime
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
@ -120,7 +120,7 @@ class TestPatch(api_base.FunctionalTest):
super(TestPatch, self).setUp()
self.node = obj_utils.create_test_node(self.context, image_id='Fedora')
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_replace_ok(self, mock_utcnow):
test_time = datetime.datetime(2000, 1, 1, 0, 0)
mock_utcnow.return_value = test_time
@ -199,7 +199,7 @@ class TestPatch(api_base.FunctionalTest):
class TestPost(api_base.FunctionalTest):
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_create_node(self, mock_utcnow):
node_dict = apiutils.node_post_data()
test_time = datetime.datetime(2000, 1, 1, 0, 0)

View File

@ -13,8 +13,8 @@
import datetime
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
@ -129,7 +129,7 @@ class TestPatch(api_base.FunctionalTest):
desc='pod_example_A_desc',
status='Running')
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_replace_ok(self, mock_utcnow):
test_time = datetime.datetime(2000, 1, 1, 0, 0)
mock_utcnow.return_value = test_time
@ -293,7 +293,7 @@ class TestPost(api_base.FunctionalTest):
pod.create()
return pod
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_create_pod(self, mock_utcnow):
pdict = apiutils.pod_post_data()
test_time = datetime.datetime(2000, 1, 1, 0, 0)

View File

@ -13,8 +13,8 @@
import datetime
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
@ -129,7 +129,7 @@ class TestPatch(api_base.FunctionalTest):
self.rc = obj_utils.create_test_rc(self.context,
images=['rc_example_A_image'])
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_replace_ok(self, mock_utcnow):
test_time = datetime.datetime(2000, 1, 1, 0, 0)
mock_utcnow.return_value = test_time
@ -269,7 +269,7 @@ class TestPost(api_base.FunctionalTest):
rc.create(self.context)
return rc
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_create_rc(self, mock_utcnow):
rc_dict = apiutils.rc_post_data()
test_time = datetime.datetime(2000, 1, 1, 0, 0)

View File

@ -13,8 +13,8 @@
import datetime
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
@ -225,7 +225,7 @@ class TestPost(api_base.FunctionalTest):
service.create()
return service
@mock.patch.object(timeutils, 'utcnow')
@mock.patch('oslo.utils.timeutils.utcnow')
def test_create_service(self, mock_utcnow):
sdict = apiutils.service_post_data()
test_time = datetime.datetime(2000, 1, 1, 0, 0)

View File

@ -18,7 +18,7 @@ import wsme
from magnum.api.controllers.v1 import utils
from magnum.tests.api import base
from oslo.config import cfg
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -14,7 +14,7 @@
# limitations under the License.
import mock
from oslo.config import fixture
from oslo_config import fixture
from magnum.api import auth
from magnum.tests import base

View File

@ -16,8 +16,8 @@
import json
import mock
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
import oslo_messaging as messaging
from magnum.api.controllers import root
from magnum.api import hooks

View File

@ -19,7 +19,7 @@ import copy
import os
import mock
from oslo.config import cfg
from oslo_config import cfg
from oslotest import base
import pecan
from pecan import testing

View File

@ -13,7 +13,7 @@
# under the License.
import mock
from oslo.config import cfg
from oslo_config import cfg
cfg.CONF.import_group('keystone_authtoken',
'keystonemiddleware.auth_token')

View File

@ -12,7 +12,7 @@
import mock
from mock import patch
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import urlfetch
from magnum.tests import base

View File

@ -23,8 +23,8 @@ import uuid
import mock
import netaddr
from oslo.config import cfg
from oslo_concurrency import processutils
from oslo_config import cfg
import six
import six.moves.builtins as __builtin__

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 magnum.conductor.handlers import kube
from magnum import objects

View File

@ -15,7 +15,7 @@
# under the License.
import fixtures
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import config

View File

@ -19,7 +19,7 @@ import os
import shutil
import fixtures
from oslo.config import cfg
from oslo_config import cfg
from magnum.common import paths
from magnum.db import api as dbapi

View File

@ -12,7 +12,7 @@
"""Tests for custom SQLAlchemy types via Magnum DB."""
from oslo.db import exception as db_exc
from oslo_db import exception as db_exc
from magnum.common import utils as magnum_utils
from magnum.db import api as dbapi

View File

@ -17,7 +17,7 @@ import gettext
import iso8601
import netaddr
from oslo.utils import timeutils
from oslo_utils import timeutils
import six
from magnum.common import context

View File

@ -15,8 +15,8 @@
import tempfile
import fixtures
from oslo.config import cfg
from oslo.db import options
from oslo_config import cfg
from oslo_db import options
from magnum.common import context
from magnum.db import api as db_api