Replace oslo_utils.encodeutils.exception_to_unicode
The function is being deprecated now because it is equivalent to str(ex) in Python 3. Depends-on: https://review.opendev.org/c/openstack/oslo.utils/+/938929 Change-Id: I2242f9f8ca92b5c9371725b1bbe54f13a0652144
This commit is contained in:
@@ -23,7 +23,6 @@ import threading
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import oslo_messaging
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
from urllib import parse as urlparse
|
||||
|
||||
@@ -64,9 +63,7 @@ class DeliveryFailure(Exception):
|
||||
|
||||
|
||||
def raise_delivery_failure(exc):
|
||||
excutils.raise_with_cause(DeliveryFailure,
|
||||
encodeutils.exception_to_unicode(exc),
|
||||
cause=exc)
|
||||
excutils.raise_with_cause(DeliveryFailure, str(exc), cause=exc)
|
||||
|
||||
|
||||
class MessagingPublisher(publisher.ConfigPublisherBase, metaclass=abc.ABCMeta):
|
||||
|
||||
@@ -17,7 +17,6 @@ from unittest import mock
|
||||
import fixtures
|
||||
from oslo_cache import core as cache
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import fileutils
|
||||
import yaml
|
||||
|
||||
@@ -267,7 +266,7 @@ class TestMeterDefinition(test.BaseTestCase):
|
||||
self.assertIn("Required fields ['name', 'type', 'event_type',"
|
||||
" 'unit', 'volume', 'resource_id']"
|
||||
" not specified",
|
||||
encodeutils.exception_to_unicode(e))
|
||||
str(e))
|
||||
|
||||
def test_bad_type_cfg_definition(self):
|
||||
cfg = dict(name="test", type="foo", event_type="bar.create",
|
||||
@@ -277,8 +276,7 @@ class TestMeterDefinition(test.BaseTestCase):
|
||||
try:
|
||||
notifications.MeterDefinition(cfg, conf, mock.Mock())
|
||||
except declarative.DefinitionException as e:
|
||||
self.assertIn("Invalid type foo specified",
|
||||
encodeutils.exception_to_unicode(e))
|
||||
self.assertIn("Invalid type foo specified", str(e))
|
||||
|
||||
|
||||
class CacheConfFixture(config_fixture.Config):
|
||||
|
||||
Reference in New Issue
Block a user