From 52a88778877ac109af4492a6fcb888e1869169f0 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Cuong Date: Tue, 6 Jun 2017 16:55:54 +0700 Subject: [PATCH] Replace deprecated BaseException.message with six.text_type DeprecationWarning: BaseException.message has been deprecated as of Python 2.6. Using six.text_type instead: Type for representing (Unicode) textual data. This is unicode() in Python 2 and str in Python 3. [1] [1] https://pythonhosted.org/six/#six.text_type See also, subclass of BaseException: https://github.com/IBM/pyxcli/blob/master/pyxcli/errors.py https://github.com/IBM/pyxcli/blob/master/pyxcli/mirroring/errors.py Change-Id: Ic7d5343bc1491e4d26383edb1cc91a4dc7e9b4e1 --- cinder/volume/drivers/ibm/ibm_storage/proxy.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cinder/volume/drivers/ibm/ibm_storage/proxy.py b/cinder/volume/drivers/ibm/ibm_storage/proxy.py index 7b53aab0b31..dbc95994bbd 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/proxy.py +++ b/cinder/volume/drivers/ibm/ibm_storage/proxy.py @@ -17,6 +17,7 @@ import functools import gettext import inspect import platform +import six from oslo_log import log as logging from oslo_utils import timeutils @@ -262,11 +263,7 @@ class IBMStorageProxy(object): return "Status: '%s', Code: %s" % ( exception.status, exception.code) - try: - msg = exception.message - except AttributeError: - msg = exception - return msg + return six.text_type(exception) def _get_driver_super(self): """Gets the IBM Storage Drivers super class