summaryrefslogtreecommitdiff
path: root/cinderclient/shell.py
diff options
context:
space:
mode:
authorEric Harney <eharney@redhat.com>2013-10-09 17:26:34 -0400
committerEric Harney <eharney@redhat.com>2013-10-09 17:31:49 -0400
commit98e9df62ee29f6d611214961ca82a162ee312030 (patch)
treefaf0eb088002a176ed7e2d6104cc0f6b4d84a04a /cinderclient/shell.py
parent4a507601d7dded2efb1bd2e885155ba38db9538c (diff)
downloadpython-cinderclient-98e9df62ee29f6d611214961ca82a162ee312030.tar.gz
Fix DeprecationWarning when printing exception
On Python 2.6, this results in an error like: /usr/lib/python2.6/site-packages/cinderclient/shell.py:524: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 message = e.message Should use the method from novaclient commit 8c4e145b92, which works well with python2 and python3. Change-Id: Ifbd78ad158ae87670bdee4e247469091efaa3260
Diffstat (limited to 'cinderclient/shell.py')
-rw-r--r--cinderclient/shell.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/cinderclient/shell.py b/cinderclient/shell.py
index c9c1529..89ba346 100644
--- a/cinderclient/shell.py
+++ b/cinderclient/shell.py
@@ -29,8 +29,6 @@ import pkgutil
import sys
import logging
-import six
-
from cinderclient import client
from cinderclient import exceptions as exc
import cinderclient.extension
@@ -521,10 +519,7 @@ def main():
sys.exit(130)
except Exception as e:
logger.debug(e, exc_info=1)
- message = e.message
- if not isinstance(message, six.string_types):
- message = str(message)
- print("ERROR: %s" % strutils.safe_encode(message), file=sys.stderr)
+ print("ERROR: %s" % strutils.six.text_type(e), file=sys.stderr)
sys.exit(1)