Make import of oslo libraries namespaceless

See https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages

Closes-Bug: 1423174
Change-Id: I48680ce6e7ce91005c147ab4388203946171d433
This commit is contained in:
Jens Rosenboom 2015-02-18 14:19:07 +01:00
parent 6395b8d39d
commit a99fe6a760
134 changed files with 208 additions and 208 deletions

View File

@ -30,8 +30,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
from oslo.config import cfg
from oslo import i18n
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log as logging
import six

View File

@ -32,8 +32,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
from oslo.config import cfg
from oslo import i18n
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log as logging
import six

View File

@ -32,8 +32,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
from oslo.config import cfg
from oslo import i18n
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log as logging
import six

View File

@ -32,8 +32,8 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
from oslo.config import cfg
from oslo import i18n
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log as logging
from heat.common.i18n import _LC

View File

@ -18,7 +18,7 @@ import sys
import keystoneclient.exceptions as kc_exception
from keystoneclient.v3 import client
from oslo.config import cfg
from oslo_config import cfg
logger = logging.getLogger(__name__)

View File

@ -15,7 +15,7 @@
# under the License.
import mock
from oslo.utils import importutils
from oslo_utils import importutils
import six
from heat.common import exception

View File

@ -14,9 +14,9 @@
"""Client Library for Keystone Resources."""
from keystoneclient.v2_0 import client as kc
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
from heat.common import exception
from heat.common.i18n import _LE

View File

@ -14,8 +14,8 @@
import mock
import mox
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
from heat.common import exception
from heat.tests import common

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import importutils
from oslo_utils import importutils
from heat.engine.clients import client_plugin

View File

@ -19,7 +19,7 @@ import time
import urlparse
from glanceclient import client as gc
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
from swiftclient import utils as swiftclient_utils
from troveclient import client as tc

View File

@ -13,8 +13,8 @@
import mock
import mox
from oslo.config import cfg
from oslo.utils import uuidutils
from oslo_config import cfg
from oslo_utils import uuidutils
import six
from heat.common import exception

View File

@ -30,7 +30,7 @@ import re
import sys
import tempfile
from oslo.config import cfg
from oslo_config import cfg
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))

View File

@ -14,6 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import i18n
import oslo_i18n as i18n
i18n.enable_lazy()

View File

@ -13,10 +13,10 @@
import hashlib
from oslo.config import cfg
from oslo.serialization import jsonutils as json
from oslo.utils import importutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from oslo_utils import importutils
import requests
import webob

View File

@ -13,8 +13,8 @@
"""Endpoint for heat AWS-compatible CloudWatch API."""
from oslo import messaging
from oslo_log import log as logging
import oslo_messaging as messaging
import six
from heat.api.aws import exception

View File

@ -23,7 +23,7 @@ import six
import traceback
from oslo.config import cfg
from oslo_config import cfg
import webob
from heat.common import exception

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from heat.common import wsgi

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from heat.api.openstack.v1 import util
from heat.common import serializers

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.messaging import exceptions
from oslo_messaging import exceptions
from webob import exc
from heat.api.openstack.v1 import util

View File

@ -19,7 +19,7 @@
import sys
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log
from heat.common import context

View File

@ -18,7 +18,7 @@ import logging
from keystoneclient import exceptions as keystone_exceptions
from keystoneclient import session
from oslo.config import cfg
from oslo_config import cfg
from webob import exc
from heat.common import context

View File

@ -14,8 +14,8 @@
# See the 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
from oslo_utils import importutils
from webob import exc
from heat.common.i18n import _

View File

@ -18,7 +18,7 @@ import logging as sys_logging
import os
from eventlet.green import socket
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
from heat.common.i18n import _

View File

@ -15,11 +15,11 @@ from keystoneclient import access
from keystoneclient.auth.identity import base
from keystoneclient.auth.identity import v3
from keystoneclient.auth import token_endpoint
from oslo.config import cfg
from oslo.middleware import request_id as oslo_request_id
from oslo.utils import importutils
from oslo_config import cfg
from oslo_context import context
from oslo_log import log as logging
from oslo_middleware import request_id as oslo_request_id
from oslo_utils import importutils
from heat.common import exception
from heat.common.i18n import _LE

View File

@ -14,7 +14,7 @@
import base64
from Crypto.Cipher import AES
from oslo.config import cfg
from oslo_config import cfg
from heat.openstack.common.crypto import utils

View File

@ -20,9 +20,9 @@ import uuid
import keystoneclient.exceptions as kc_exception
from keystoneclient import session
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_log import log as logging
from oslo_utils import importutils
from heat.common import context
from heat.common import exception

View File

@ -16,7 +16,7 @@
# It's based on oslo.i18n usage in OpenStack Keystone project and
# recommendations from http://docs.openstack.org/developer/oslo.i18n/usage.html
from oslo import i18n
import oslo_i18n as i18n
_translators = i18n.TranslatorFactory(domain='heat')

View File

@ -14,7 +14,7 @@
import collections
import re
from oslo.utils import encodeutils
from oslo_utils import encodeutils
from six.moves.urllib import parse as urlparse
from heat.common.i18n import _

View File

@ -16,9 +16,9 @@
# under the License.
import eventlet
from oslo.config import cfg
import oslo.messaging
from oslo.serialization import jsonutils
from oslo_config import cfg
import oslo_messaging
from oslo_serialization import jsonutils
from osprofiler import profiler
from heat.common import context
@ -34,7 +34,7 @@ _ALIASES = {
}
class RequestContextSerializer(oslo.messaging.Serializer):
class RequestContextSerializer(oslo_messaging.Serializer):
def __init__(self, base):
self._base = base
@ -69,41 +69,41 @@ class RequestContextSerializer(oslo.messaging.Serializer):
return context.RequestContext.from_dict(ctxt)
class JsonPayloadSerializer(oslo.messaging.NoOpSerializer):
class JsonPayloadSerializer(oslo_messaging.NoOpSerializer):
@classmethod
def serialize_entity(cls, context, entity):
return jsonutils.to_primitive(entity, convert_instances=True)
def setup(url=None, optional=False):
"""Initialise the oslo.messaging layer."""
"""Initialise the oslo_messaging layer."""
global TRANSPORT, NOTIFIER
if url and url.startswith("fake://"):
# NOTE(sileht): oslo.messaging fake driver uses time.sleep
# NOTE(sileht): oslo_messaging fake driver uses time.sleep
# for task switch, so we need to monkey_patch it
eventlet.monkey_patch(time=True)
if not TRANSPORT:
oslo.messaging.set_transport_defaults('heat')
oslo_messaging.set_transport_defaults('heat')
exmods = ['heat.common.exception']
try:
TRANSPORT = oslo.messaging.get_transport(
TRANSPORT = oslo_messaging.get_transport(
cfg.CONF, url, allowed_remote_exmods=exmods, aliases=_ALIASES)
except oslo.messaging.InvalidTransportURL as e:
except oslo_messaging.InvalidTransportURL as e:
TRANSPORT = None
if not optional or e.url:
# NOTE(sileht): oslo.messaging is configured but unloadable
# NOTE(sileht): oslo_messaging is configured but unloadable
# so reraise the exception
raise
if not NOTIFIER and TRANSPORT:
serializer = RequestContextSerializer(JsonPayloadSerializer())
NOTIFIER = oslo.messaging.Notifier(TRANSPORT, serializer=serializer)
NOTIFIER = oslo_messaging.Notifier(TRANSPORT, serializer=serializer)
def cleanup():
"""Cleanup the oslo.messaging layer."""
"""Cleanup the oslo_messaging layer."""
global TRANSPORT, NOTIFIER
if TRANSPORT:
TRANSPORT.cleanup()
@ -111,21 +111,21 @@ def cleanup():
def get_rpc_server(target, endpoint):
"""Return a configured oslo.messaging rpc server."""
"""Return a configured oslo_messaging rpc server."""
serializer = RequestContextSerializer(JsonPayloadSerializer())
return oslo.messaging.get_rpc_server(TRANSPORT, target, [endpoint],
return oslo_messaging.get_rpc_server(TRANSPORT, target, [endpoint],
executor='eventlet',
serializer=serializer)
def get_rpc_client(**kwargs):
"""Return a configured oslo.messaging RPCClient."""
target = oslo.messaging.Target(**kwargs)
"""Return a configured oslo_messaging RPCClient."""
target = oslo_messaging.Target(**kwargs)
serializer = RequestContextSerializer(JsonPayloadSerializer())
return oslo.messaging.RPCClient(TRANSPORT, target,
return oslo_messaging.RPCClient(TRANSPORT, target,
serializer=serializer)
def get_notifier(publisher_id):
"""Return a configured oslo.messaging notifier."""
"""Return a configured oslo_messaging notifier."""
return NOTIFIER.prepare(publisher_id=publisher_id)

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
from oslo_utils import strutils
from heat.common.i18n import _

View File

@ -17,7 +17,7 @@
# Based on glance/api/policy.py
"""Policy Engine For Heat"""
from oslo.config import cfg
from oslo_config import cfg
from heat.common import exception
from heat.openstack.common import policy

View File

@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo import messaging
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
import osprofiler.profiler
import osprofiler.web

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.utils import timeutils
from oslo_utils import timeutils
SERVICE_KEYS = (
SERVICE_ID,

View File

@ -15,7 +15,7 @@ import itertools
import json
import re
from oslo.config import cfg
from oslo_config import cfg
import six
import yaml

View File

@ -13,7 +13,7 @@
"""Utility for fetching a resource (e.g. a template) from a URL."""
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
import requests
from requests import exceptions

View File

@ -34,9 +34,9 @@ from eventlet.green import socket
from eventlet.green import ssl
import eventlet.greenio
import eventlet.wsgi
from oslo.config import cfg
from oslo import i18n
from oslo.utils import importutils
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_utils import importutils
from paste import deploy
import routes
import routes.middleware

View File

@ -24,8 +24,8 @@ The underlying driver is loaded . SQLAlchemy is currently the only
supported backend.
'''
from oslo.config import cfg
from oslo.db import api
from oslo_config import cfg
from oslo_db import api
CONF = cfg.CONF

View File

@ -15,10 +15,10 @@
import datetime
import sys
from oslo.config import cfg
from oslo.db.sqlalchemy import session as db_session
from oslo.db.sqlalchemy import utils
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_db.sqlalchemy import session as db_session
from oslo_db.sqlalchemy import utils
from oslo_utils import timeutils
import osprofiler.sqlalchemy
import six
import sqlalchemy

View File

@ -15,7 +15,7 @@ import itertools
import uuid
import migrate.changeset.constraint as constraint
from oslo.utils import timeutils
from oslo_utils import timeutils
import sqlalchemy

View File

@ -12,7 +12,7 @@
# under the License.
from migrate.versioning import util as migrate_util
from oslo.serialization import jsonutils
from oslo_serialization import jsonutils
import six
import sqlalchemy
from sqlalchemy.orm import sessionmaker

View File

@ -11,7 +11,7 @@
# under the License.
from migrate.versioning import util as migrate_util
from oslo.serialization import jsonutils
from oslo_serialization import jsonutils
import six
import sqlalchemy
from sqlalchemy.orm import sessionmaker

View File

@ -13,7 +13,7 @@
import time
from migrate.versioning import util as migrate_util
from oslo.serialization import jsonutils
from oslo_serialization import jsonutils
import sqlalchemy
from sqlalchemy.orm import sessionmaker

View File

@ -13,7 +13,7 @@
import os
from oslo.db.sqlalchemy import migration as oslo_migration
from oslo_db.sqlalchemy import migration as oslo_migration
INIT_VERSION = 14

View File

@ -16,8 +16,8 @@ SQLAlchemy models for heat data.
import uuid
from oslo.db.sqlalchemy import models
from oslo.utils import timeutils
from oslo_db.sqlalchemy import models
from oslo_utils import timeutils
import six
import sqlalchemy
from sqlalchemy.ext import declarative

View File

@ -13,8 +13,8 @@
import collections
from oslo.utils import timeutils
from oslo_log import log as logging
from oslo_utils import timeutils
from heat.common.i18n import _
from heat.common.i18n import _LE

View File

@ -13,9 +13,9 @@
import warnings
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
import six
from stevedore import extension

View File

@ -15,7 +15,7 @@ import abc
from keystoneclient import exceptions
from keystoneclient import session
from oslo.config import cfg
from oslo_config import cfg
import six
@ -136,4 +136,4 @@ class ClientPlugin(object):
if self.is_conflict(ex) or self.is_not_found(ex):
return
else:
raise ex
raise ex

View File

@ -13,8 +13,8 @@
from glanceclient import client as gc
from glanceclient import exc
from oslo.utils import uuidutils
from oslo_log import log as logging
from oslo_utils import uuidutils
from heat.common import exception
from heat.common.i18n import _

View File

@ -14,7 +14,7 @@
from neutronclient.common import exceptions
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.v2_0 import client as nc
from oslo.utils import uuidutils
from oslo_utils import uuidutils
from heat.common import exception
from heat.engine.clients import client_plugin

View File

@ -24,8 +24,8 @@ import string
from novaclient import client as nc
from novaclient import exceptions
from novaclient import shell as novashell
from oslo.config import cfg
from oslo.utils import uuidutils
from oslo_config import cfg
from oslo_utils import uuidutils
import six
from six.moves.urllib import parse as urlparse

View File

@ -15,7 +15,7 @@ import collections
import numbers
import re
from oslo.utils import strutils
from oslo_utils import strutils
import six
from heat.common import exception

View File

@ -14,7 +14,7 @@
import collections
import itertools
from oslo.utils import encodeutils
from oslo_utils import encodeutils
import six
from heat.common import exception

View File

@ -17,7 +17,7 @@ import itertools
import os.path
import warnings
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log
import six

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from heat.common import messaging

View File

@ -15,8 +15,8 @@ import collections
import itertools
import json
from oslo.utils import encodeutils
from oslo.utils import strutils
from oslo_utils import encodeutils
from oslo_utils import strutils
import six
from heat.common import exception

View File

@ -15,7 +15,7 @@ import collections
import itertools
import sys
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log
import six

View File

@ -16,10 +16,10 @@ import contextlib
import datetime as dt
import warnings
from oslo.config import cfg
from oslo.utils import encodeutils
from oslo.utils import excutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import encodeutils
from oslo_utils import excutils
import six
from heat.common import exception

View File

@ -13,8 +13,8 @@
import math
from oslo.utils import excutils
from oslo_log import log as logging
from oslo_utils import excutils
import six
from heat.common import exception

View File

@ -13,7 +13,7 @@
import copy
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
import six

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from heat.common import exception
from heat.common.i18n import _

View File

@ -11,8 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import excutils
from oslo_log import log as logging
from oslo_utils import excutils
import six
from heat.common import exception

View File

@ -12,7 +12,7 @@
# under the License.
import os
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
import six

View File

@ -10,7 +10,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import uuidutils
from oslo_utils import uuidutils
import six
import warnings

View File

@ -12,8 +12,8 @@
# under the License.
from heat.common import exception
from oslo.utils import excutils
from oslo_log import log as logging
from oslo_utils import excutils
import six
from heat.common.i18n import _

View File

@ -22,7 +22,7 @@ import string
import warnings
from novaclient import exceptions as nova_exceptions
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
import six
from six.moves.urllib import parse as urlparse

View File

@ -14,10 +14,10 @@
import copy
import uuid
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import uuidutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
import six
from heat.common import exception

View File

@ -18,9 +18,9 @@ import time
import types
import eventlet
from oslo.utils import encodeutils
from oslo.utils import excutils
from oslo_log import log as logging
from oslo_utils import encodeutils
from oslo_utils import excutils
import six
from heat.common.i18n import _

View File

@ -19,12 +19,12 @@ import socket
import warnings
import eventlet
from oslo.config import cfg
from oslo import messaging
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo.utils import uuidutils
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from oslo_utils import timeutils
from oslo_utils import uuidutils
from osprofiler import profiler
import requests
import six

View File

@ -11,8 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from oslo_log import log as logging
from oslo_utils import timeutils
from heat.common import context
from heat.common.i18n import _LE

View File

@ -12,7 +12,7 @@
# under the License.
from keystoneclient.contrib.ec2 import utils as ec2_utils
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
from six.moves.urllib import parse as urlparse

View File

@ -17,9 +17,9 @@ import datetime
import re
import warnings
from oslo.config import cfg
from oslo.utils import encodeutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import encodeutils
from osprofiler import profiler
import six

View File

@ -14,10 +14,10 @@
import contextlib
import uuid
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import excutils
from heat.common import exception
from heat.common.i18n import _LI

View File

@ -13,9 +13,9 @@
import hashlib
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
import six
from heat.common import exception

View File

@ -14,8 +14,8 @@
import datetime
from oslo.utils import timeutils
from oslo_log import log as logging
from oslo_utils import timeutils
from heat.common import exception
from heat.common.i18n import _

View File

@ -17,14 +17,14 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
try:
import oslo.i18n
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo.i18n.TranslatorFactory(domain='heat')
_translators = oslo_i18n.TranslatorFactory(domain='heat')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -29,7 +29,7 @@ import base64
from Crypto.Hash import HMAC
from Crypto import Random
from oslo.utils import importutils
from oslo_utils import importutils
import six
from heat.openstack.common._i18n import _

View File

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

View File

@ -20,7 +20,7 @@ import os
import stat
import tempfile
from oslo.utils import excutils
from oslo_utils import excutils
LOG = logging.getLogger(__name__)

View File

@ -12,7 +12,7 @@
"""Compatibility shim for Kilo, while operators migrate to oslo.middleware."""
from oslo.middleware import request_id
from oslo_middleware import request_id
from heat.openstack.common import versionutils