diff --git a/ironic_lib/disk_utils.py b/ironic_lib/disk_utils.py index 5a1f2507..1dd905db 100644 --- a/ironic_lib/disk_utils.py +++ b/ironic_lib/disk_utils.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +import base64 import gzip import io import logging @@ -27,7 +28,6 @@ import time from oslo_concurrency import processutils from oslo_config import cfg -from oslo_serialization import base64 from oslo_utils import excutils from oslo_utils import imageutils from oslo_utils import units @@ -564,7 +564,7 @@ def _get_configdrive(configdrive, node_uuid, tempdir=None): dir=tempdir) try: - data = io.BytesIO(base64.decode_as_bytes(data)) + data = io.BytesIO(base64.b64decode(data)) except Exception as exc: if isinstance(data, bytes): LOG.debug('Config drive for node %(node)s is not base64 encoded ' diff --git a/ironic_lib/exception.py b/ironic_lib/exception.py index 226010a8..c2ec0cf1 100644 --- a/ironic_lib/exception.py +++ b/ironic_lib/exception.py @@ -24,10 +24,10 @@ SHOULD include dedicated exception logging. import collections from http import client as http_client +import json from oslo_config import cfg from oslo_log import log as logging -from oslo_serialization import jsonutils from oslo_utils import excutils from ironic_lib.common.i18n import _ @@ -67,7 +67,7 @@ def _ensure_exception_kwargs_serializable(exc_class_name, kwargs): constructor. :returns: a dictionary of serializable keyword arguments. """ - serializers = [(jsonutils.dumps, _('when converting to JSON')), + serializers = [(json.dumps, _('when converting to JSON')), (str, _('when converting to string'))] exceptions = collections.defaultdict(list) serializable_kwargs = {} diff --git a/ironic_lib/tests/test_exception.py b/ironic_lib/tests/test_exception.py index b7829c4e..c5197564 100644 --- a/ironic_lib/tests/test_exception.py +++ b/ironic_lib/tests/test_exception.py @@ -53,8 +53,8 @@ class TestIronicException(base.IronicLibTestCase): e = TestException(spam=Unserializable(), ham='eggs') message = log_mock.call_args[0][0] % log_mock.call_args[0][1] self.assertIsNotNone( - re.search('spam: .*JSON.* ValueError: Circular reference detected;' - '.*string.* NotImplementedError: nostr', message) + re.search('spam: .*JSON.* NotImplementedError: nostr', message), + message ) self.assertEqual({'ham': '"eggs"', 'code': 500}, e.kwargs) @@ -66,6 +66,6 @@ class TestIronicException(base.IronicLibTestCase): ham='eggs') message = log_mock.call_args[0][0] % log_mock.call_args[0][1] self.assertIsNotNone( - re.search('spam: .*JSON.* ValueError: Circular reference detected;' - '.*string.* NotImplementedError: nostr', message) + re.search('spam: .*JSON.* NotImplementedError: nostr', message), + message ) diff --git a/requirements.txt b/requirements.txt index 87ba5b35..21a31532 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 oslo.concurrency>=3.26.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 -oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 requests>=2.14.2 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0