summaryrefslogtreecommitdiff
path: root/oslo_vmware/exceptions.py
diff options
context:
space:
mode:
authorHervé Beraud <hberaud@redhat.com>2020-03-02 12:12:37 +0100
committerHervé Beraud <hberaud@redhat.com>2020-03-02 14:52:23 +0100
commit88798e9ad8d251dfd76ff34be622c467b1b2d94a (patch)
tree2ef497ed683d646c2dc1c2fc8bc3bb9d87783ebb /oslo_vmware/exceptions.py
parentcb40fac97296d431a32585cf40ef5ef80e8e9075 (diff)
downloadoslo-vmware-88798e9ad8d251dfd76ff34be622c467b1b2d94a.tar.gz
Drop use of six
Change-Id: I7b1fd3412b815d88b6d54178566f4089433f98ff
Diffstat (limited to 'oslo_vmware/exceptions.py')
-rw-r--r--oslo_vmware/exceptions.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/oslo_vmware/exceptions.py b/oslo_vmware/exceptions.py
index df6d676..a7a9bcb 100644
--- a/oslo_vmware/exceptions.py
+++ b/oslo_vmware/exceptions.py
@@ -19,8 +19,6 @@ Exception definitions.
import logging
-import six
-
from oslo_vmware._i18n import _
LOG = logging.getLogger(__name__)
@@ -53,11 +51,7 @@ class VMwareDriverException(Exception):
"""
msg_fmt = _("An unknown exception occurred.")
- if six.PY2:
- __str__ = lambda self: six.text_type(self).encode('utf8')
- __unicode__ = lambda self: self.description
- else:
- __str__ = lambda self: self.description
+ __str__ = lambda self: self.description
def __init__(self, message=None, details=None, **kwargs):
@@ -80,7 +74,7 @@ class VMwareDriverException(Exception):
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception('Exception in string format operation')
- for name, value in six.iteritems(kwargs):
+ for name, value in kwargs.items():
LOG.error("%(name)s: %(value)s",
{'name': name, 'value': value})
# at least get the core message out if something happened
@@ -98,9 +92,9 @@ class VMwareDriverException(Exception):
# NOTE(jecarey): self.msg and self.cause may be i18n objects
# that do not support str or concatenation, but can be used
# as replacement text.
- descr = six.text_type(self.msg)
+ descr = str(self.msg)
if self.cause:
- descr += '\nCause: ' + six.text_type(self.cause)
+ descr += '\nCause: ' + str(self.cause)
return descr
@@ -154,7 +148,7 @@ class VimFaultException(VimException):
if self.details:
# details may contain non-ASCII values
details = '{%s}' % ', '.join(["'%s': '%s'" % (k, v) for k, v in
- six.iteritems(self.details)])
+ self.details.items()])
descr += '\nDetails: ' + details
return descr
@@ -306,7 +300,7 @@ def translate_fault(localized_method_fault, excep_msg=None):
"""
try:
if not excep_msg:
- excep_msg = six.text_type(localized_method_fault.localizedMessage)
+ excep_msg = str(localized_method_fault.localizedMessage)
name = localized_method_fault.fault.__class__.__name__
fault_class = get_fault_class(name)
if fault_class: