Merge "Get rid of oslo.serialization"

This commit is contained in:
Zuul 2021-01-30 10:18:06 +00:00 committed by Gerrit Code Review
commit 7fa890fb01
4 changed files with 8 additions and 9 deletions

View File

@ -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 '

View File

@ -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 = {}

View File

@ -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
)

View File

@ -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