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: I7c9ca3730e1ab6ffdaf8cb78c002ac4e157fe2f1
This commit is contained in:
@@ -660,4 +660,4 @@ def main():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
if utils.debug_enabled(argv) is True:
|
if utils.debug_enabled(argv) is True:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
utils.exit(encodeutils.exception_to_unicode(e))
|
utils.exit(str(e))
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ class Controller(object):
|
|||||||
try:
|
try:
|
||||||
setattr(image, key, value)
|
setattr(image, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
resp, body = self.http_client.post(url, headers=headers, data=image)
|
resp, body = self.http_client.post(url, headers=headers, data=image)
|
||||||
# NOTE(esheffield): remove 'self' for now until we have an elegant
|
# NOTE(esheffield): remove 'self' for now until we have an elegant
|
||||||
@@ -443,7 +443,7 @@ class Controller(object):
|
|||||||
try:
|
try:
|
||||||
setattr(image, key, value)
|
setattr(image, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
if remove_props:
|
if remove_props:
|
||||||
cur_props = image.keys()
|
cur_props = image.keys()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class NamespaceController(object):
|
|||||||
try:
|
try:
|
||||||
namespace = self.model(kwargs)
|
namespace = self.model(kwargs)
|
||||||
except (warlock.InvalidOperation, ValueError) as e:
|
except (warlock.InvalidOperation, ValueError) as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
resp, body = self.http_client.post(url, data=namespace)
|
resp, body = self.http_client.post(url, data=namespace)
|
||||||
body.pop('self', None)
|
body.pop('self', None)
|
||||||
@@ -63,7 +63,7 @@ class NamespaceController(object):
|
|||||||
try:
|
try:
|
||||||
setattr(namespace, key, value)
|
setattr(namespace, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
# Remove read-only parameters.
|
# Remove read-only parameters.
|
||||||
read_only = ['schema', 'updated_at', 'created_at']
|
read_only = ['schema', 'updated_at', 'created_at']
|
||||||
@@ -212,7 +212,7 @@ class ResourceTypeController(object):
|
|||||||
try:
|
try:
|
||||||
res_type = self.model(kwargs)
|
res_type = self.model(kwargs)
|
||||||
except (warlock.InvalidOperation, ValueError) as e:
|
except (warlock.InvalidOperation, ValueError) as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
url = '/v2/metadefs/namespaces/%(namespace)s/resource_types' % {
|
url = '/v2/metadefs/namespaces/%(namespace)s/resource_types' % {
|
||||||
'namespace': namespace}
|
'namespace': namespace}
|
||||||
@@ -272,7 +272,7 @@ class PropertyController(object):
|
|||||||
try:
|
try:
|
||||||
prop = self.model(kwargs)
|
prop = self.model(kwargs)
|
||||||
except (warlock.InvalidOperation, ValueError) as e:
|
except (warlock.InvalidOperation, ValueError) as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
url = '/v2/metadefs/namespaces/%(namespace)s/properties' % {
|
url = '/v2/metadefs/namespaces/%(namespace)s/properties' % {
|
||||||
'namespace': namespace}
|
'namespace': namespace}
|
||||||
@@ -292,7 +292,7 @@ class PropertyController(object):
|
|||||||
try:
|
try:
|
||||||
setattr(prop, key, value)
|
setattr(prop, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
url = ('/v2/metadefs/namespaces/%(namespace)s/'
|
url = ('/v2/metadefs/namespaces/%(namespace)s/'
|
||||||
'properties/%(prop_name)s') % {
|
'properties/%(prop_name)s') % {
|
||||||
@@ -374,7 +374,7 @@ class ObjectController(object):
|
|||||||
try:
|
try:
|
||||||
obj = self.model(kwargs)
|
obj = self.model(kwargs)
|
||||||
except (warlock.InvalidOperation, ValueError) as e:
|
except (warlock.InvalidOperation, ValueError) as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
url = '/v2/metadefs/namespaces/%(namespace)s/objects' % {
|
url = '/v2/metadefs/namespaces/%(namespace)s/objects' % {
|
||||||
'namespace': namespace}
|
'namespace': namespace}
|
||||||
@@ -395,7 +395,7 @@ class ObjectController(object):
|
|||||||
try:
|
try:
|
||||||
setattr(obj, key, value)
|
setattr(obj, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
# Remove read-only parameters.
|
# Remove read-only parameters.
|
||||||
read_only = ['schema', 'updated_at', 'created_at']
|
read_only = ['schema', 'updated_at', 'created_at']
|
||||||
@@ -499,7 +499,7 @@ class TagController(object):
|
|||||||
try:
|
try:
|
||||||
md_tag_list.append(self.model(name=tag_name))
|
md_tag_list.append(self.model(name=tag_name))
|
||||||
except (warlock.InvalidOperation) as e:
|
except (warlock.InvalidOperation) as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
tags = {'tags': md_tag_list}
|
tags = {'tags': md_tag_list}
|
||||||
headers = {}
|
headers = {}
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ class TagController(object):
|
|||||||
try:
|
try:
|
||||||
setattr(tag, key, value)
|
setattr(tag, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
# Remove read-only parameters.
|
# Remove read-only parameters.
|
||||||
read_only = ['updated_at', 'created_at']
|
read_only = ['updated_at', 'created_at']
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class Controller(object):
|
|||||||
try:
|
try:
|
||||||
setattr(task, key, value)
|
setattr(task, key, value)
|
||||||
except warlock.InvalidOperation as e:
|
except warlock.InvalidOperation as e:
|
||||||
raise TypeError(encodeutils.exception_to_unicode(e))
|
raise TypeError(str(e))
|
||||||
|
|
||||||
resp, body = self.http_client.post(url, data=task)
|
resp, body = self.http_client.post(url, data=task)
|
||||||
# NOTE(flwang): remove 'self' for now until we have an elegant
|
# NOTE(flwang): remove 'self' for now until we have an elegant
|
||||||
|
|||||||
Reference in New Issue
Block a user