Merge "Fix DeprecationWarning when printing exception"

This commit is contained in:
Jenkins 2013-10-11 22:33:17 +00:00 committed by Gerrit Code Review
commit 728a3419c9

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)