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
This commit is contained in:
Eric Harney 2013-10-09 17:26:34 -04:00
parent 4a507601d7
commit 98e9df62ee

View File

@ -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)