Migration to oslo.utils library
oslo.utils has been released with the modules excutils, importutils, strutils and timeutils. Changes done: - Use the new oslo.utils modules when possible (not updated in the nova.ironic driver and other oslo.incubator modules) - importutils.import_module now is importutils.try_import - Updated requirements.txt with the new library - strutils.to_bytes now is strutils.string_to_bytes Once the nova.ironic driver is migrated into nova tree, old references and libraries can be cleaned (Bug: #1350269) Closes-Bug: #1353540 Change-Id: Ic0af04ebd07b23eb94df32a6abf0e490d597f32a
This commit is contained in:
parent
689052700c
commit
4723aec443
@ -15,12 +15,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.utils import strutils
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import utils
|
||||
from ironic.openstack.common import strutils
|
||||
|
||||
|
||||
class MacAddressType(wtypes.UserType):
|
||||
|
@ -18,12 +18,12 @@ import copy
|
||||
import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.openstack.common import jsonutils
|
||||
from ironic.openstack.common import timeutils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -15,9 +15,8 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from ironic.openstack.common import importutils
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
|
||||
glance_opts = [
|
||||
@ -58,7 +57,7 @@ def import_versioned_module(version, submodule=None):
|
||||
module = 'ironic.common.glance_service.v%s' % version
|
||||
if submodule:
|
||||
module = '.'.join((module, submodule))
|
||||
return importutils.import_module(module)
|
||||
return importutils.try_import(module)
|
||||
|
||||
|
||||
def Service(client=None, version=1, context=None):
|
||||
|
@ -20,13 +20,13 @@ import socket
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo import messaging
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import config
|
||||
from ironic.common import rpc
|
||||
from ironic.objects import base as objects_base
|
||||
from ironic.openstack.common import context
|
||||
from ironic.openstack.common.gettextutils import _LI
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.openstack.common import log
|
||||
from ironic.openstack.common import service
|
||||
|
||||
@ -54,7 +54,7 @@ class RPCService(service.Service):
|
||||
def __init__(self, host, manager_module, manager_class):
|
||||
super(RPCService, self).__init__()
|
||||
self.host = host
|
||||
manager_module = importutils.import_module(manager_module)
|
||||
manager_module = importutils.try_import(manager_module)
|
||||
manager_class = getattr(manager_module, manager_class)
|
||||
self.manager = manager_class(host, manager_module.MANAGER_TOPIC)
|
||||
self.topic = self.manager.topic
|
||||
|
@ -50,6 +50,7 @@ from eventlet import greenpool
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo import messaging
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import driver_factory
|
||||
from ironic.common import exception
|
||||
@ -63,7 +64,6 @@ from ironic.conductor import task_manager
|
||||
from ironic.conductor import utils
|
||||
from ironic.db import api as dbapi
|
||||
from ironic import objects
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common import lockutils
|
||||
from ironic.openstack.common import log
|
||||
from ironic.openstack.common import periodic_task
|
||||
|
@ -88,8 +88,7 @@ code when the spawned task generates an exception:
|
||||
import retrying
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ironic.openstack.common import excutils
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import driver_factory
|
||||
from ironic.common import exception
|
||||
|
@ -12,10 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common.gettextutils import _LI
|
||||
from ironic.openstack.common import log
|
||||
|
||||
|
@ -24,6 +24,7 @@ from oslo.db import exception as db_exc
|
||||
from oslo.db import options as db_options
|
||||
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 ironic.common import exception
|
||||
@ -34,7 +35,6 @@ from ironic.db import api
|
||||
from ironic.db.sqlalchemy import models
|
||||
from ironic import objects
|
||||
from ironic.openstack.common import log
|
||||
from ironic.openstack.common import timeutils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('heartbeat_timeout',
|
||||
|
@ -17,6 +17,8 @@
|
||||
Fake drivers used in testing.
|
||||
"""
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import agent
|
||||
@ -28,7 +30,6 @@ from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules import seamicro
|
||||
from ironic.drivers.modules import ssh
|
||||
from ironic.drivers import utils
|
||||
from ironic.openstack.common import importutils
|
||||
|
||||
|
||||
class FakeDriver(base.BaseDriver):
|
||||
|
@ -15,10 +15,11 @@
|
||||
iLO Driver for managing HP Proliant Gen8 and above servers.
|
||||
"""
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules.ilo import power
|
||||
from ironic.openstack.common import importutils
|
||||
|
||||
|
||||
class IloDriver(base.BaseDriver):
|
||||
|
@ -16,6 +16,7 @@ import os
|
||||
import time
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import i18n
|
||||
@ -33,7 +34,6 @@ from ironic.drivers import base
|
||||
from ironic.drivers.modules import agent_client
|
||||
from ironic.drivers.modules import image_cache
|
||||
from ironic import objects
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common import fileutils
|
||||
from ironic.openstack.common import log
|
||||
|
||||
|
@ -20,10 +20,11 @@ import socket
|
||||
import stat
|
||||
import time
|
||||
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import disk_partitioner
|
||||
from ironic.common import exception
|
||||
from ironic.common import utils
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import processutils
|
||||
|
||||
|
@ -19,11 +19,12 @@
|
||||
Ironic iBoot PDU power manager.
|
||||
"""
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.openstack.common import log as logging
|
||||
|
||||
iboot = importutils.try_import('iboot')
|
||||
|
@ -17,9 +17,9 @@ Common functionalities shared between different iLO modules.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.openstack.common import log as logging
|
||||
|
||||
ilo_client = importutils.try_import('proliantutils.ilo.ribcl')
|
||||
|
@ -17,13 +17,13 @@ iLO Power Driver
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import loopingcall
|
||||
|
||||
|
@ -20,6 +20,7 @@ Ironic Native IPMI power manager.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import exception
|
||||
@ -27,7 +28,6 @@ from ironic.common import i18n
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.openstack.common import log as logging
|
||||
|
||||
pyghmi = importutils.try_import('pyghmi')
|
||||
|
@ -37,6 +37,7 @@ import tempfile
|
||||
import time
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import exception
|
||||
@ -46,7 +47,6 @@ from ironic.common import utils
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import console_utils
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import loopingcall
|
||||
from ironic.openstack.common import processutils
|
||||
|
@ -20,6 +20,7 @@ PXE Driver and supporting meta-classes.
|
||||
import os
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import strutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import image_service as service
|
||||
@ -38,7 +39,6 @@ from ironic.drivers.modules import image_cache
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.openstack.common import fileutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import strutils
|
||||
|
||||
|
||||
pxe_opts = [
|
||||
|
@ -20,6 +20,7 @@ Provides vendor passthru methods for SeaMicro specific functionality.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import exception
|
||||
@ -27,7 +28,6 @@ from ironic.common import i18n
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import loopingcall
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
PXE Driver and supporting meta-classes.
|
||||
"""
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import iboot
|
||||
@ -26,7 +28,6 @@ from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules import seamicro
|
||||
from ironic.drivers.modules import ssh
|
||||
from ironic.drivers import utils
|
||||
from ironic.openstack.common import importutils
|
||||
|
||||
|
||||
class PXEAndIPMIToolDriver(base.BaseDriver):
|
||||
|
@ -19,10 +19,9 @@ import datetime
|
||||
|
||||
import iso8601
|
||||
import netaddr
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from ironic.openstack.common import timeutils
|
||||
|
||||
|
||||
def datetime_or_none(dt):
|
||||
"""Validate a datetime or None value."""
|
||||
|
@ -20,10 +20,10 @@ import datetime
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.db.openstack.common import timeutils as db_timeutils
|
||||
from oslo.utils import timeutils
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ironic.common import utils
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.api import base
|
||||
from ironic.tests.api import utils as apiutils
|
||||
from ironic.tests.db import utils as dbutils
|
||||
|
@ -20,6 +20,7 @@ import datetime
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.db.openstack.common import timeutils as db_timeutils
|
||||
from oslo.utils import timeutils
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
@ -29,7 +30,6 @@ from ironic.common import utils
|
||||
from ironic.conductor import rpcapi
|
||||
from ironic import objects
|
||||
from ironic.openstack.common import context
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.api import base
|
||||
from ironic.tests.api import utils as apiutils
|
||||
from ironic.tests.db import utils as dbutils
|
||||
|
@ -20,6 +20,7 @@ import datetime
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.db.openstack.common import timeutils as db_timeutils
|
||||
from oslo.utils import timeutils
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
@ -27,7 +28,6 @@ from ironic.common import exception
|
||||
from ironic.common import utils
|
||||
from ironic.conductor import rpcapi
|
||||
from ironic.openstack.common import context
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.api import base
|
||||
from ironic.tests.api import utils as apiutils
|
||||
from ironic.tests.db import utils as dbutils
|
||||
|
@ -18,10 +18,10 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.db import api as dbapi
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.db import base
|
||||
from ironic.tests.db import utils
|
||||
|
||||
|
@ -18,13 +18,13 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.common import utils as ironic_utils
|
||||
from ironic.db import api as dbapi
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.db import base
|
||||
from ironic.tests.db import utils
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
import mock
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.db import api as dbapi
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.openstack.common import context
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.tests import base
|
||||
from ironic.tests.db import utils as db_utils
|
||||
from ironic.tests.objects import utils as obj_utils
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
@ -25,7 +26,6 @@ from ironic.db import api as dbapi
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.drivers.modules.ilo import power as ilo_power
|
||||
from ironic.openstack.common import context
|
||||
from ironic.openstack.common import importutils
|
||||
from ironic.tests import base
|
||||
from ironic.tests.conductor import utils as mgr_utils
|
||||
from ironic.tests.db import utils as db_utils
|
||||
|
@ -29,9 +29,9 @@ Current list of mocked libraries:
|
||||
import sys
|
||||
|
||||
import mock
|
||||
from oslo.utils import importutils
|
||||
|
||||
from ironic.drivers.modules import ipmitool
|
||||
from ironic.openstack.common import importutils
|
||||
|
||||
|
||||
# attempt to load the external 'seamicroclient' library, which is
|
||||
|
@ -17,12 +17,12 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from ironic.db import api as db_api
|
||||
from ironic.db.sqlalchemy import models
|
||||
from ironic import objects
|
||||
from ironic.objects import utils as obj_utils
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.db import base
|
||||
from ironic.tests.db import utils
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.db import api as db_api
|
||||
from ironic.db.sqlalchemy import models
|
||||
from ironic import objects
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests.db import base
|
||||
from ironic.tests.db import utils
|
||||
|
||||
|
@ -18,13 +18,13 @@ import gettext
|
||||
|
||||
import iso8601
|
||||
import netaddr
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.objects import base
|
||||
from ironic.objects import utils
|
||||
from ironic.openstack.common import context
|
||||
from ironic.openstack.common import timeutils
|
||||
from ironic.tests import base as test_base
|
||||
|
||||
gettext.install('ironic')
|
||||
|
@ -19,9 +19,10 @@
|
||||
import contextlib
|
||||
import fixtures
|
||||
|
||||
from oslo.utils import excutils
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import images
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.tests import base
|
||||
|
||||
|
||||
|
@ -9,18 +9,15 @@ module=excutils
|
||||
module=fileutils
|
||||
module=gettextutils
|
||||
module=imageutils
|
||||
module=importutils
|
||||
module=jsonutils
|
||||
module=local
|
||||
module=lockutils
|
||||
module=log
|
||||
module=loopingcall
|
||||
module=network_utils
|
||||
module=periodic_task
|
||||
module=policy
|
||||
module=processutils
|
||||
module=service
|
||||
module=strutils
|
||||
module=timeutils
|
||||
module=versionutils
|
||||
|
||||
|
@ -25,6 +25,7 @@ oslo.config>=1.4.0.0a3
|
||||
oslo.db>=0.2.0 # Apache-2.0
|
||||
oslo.rootwrap>=1.3.0.0a1
|
||||
oslo.i18n>=0.1.0 # Apache-2.0
|
||||
oslo.utils>=0.1.1 # Apache-2.0
|
||||
pecan>=0.5.0
|
||||
six>=1.7.0
|
||||
jsonpatch>=1.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user