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 sys
import logging import logging
import six
from cinderclient import client from cinderclient import client
from cinderclient import exceptions as exc from cinderclient import exceptions as exc
import cinderclient.extension import cinderclient.extension
@ -521,10 +519,7 @@ def main():
sys.exit(130) sys.exit(130)
except Exception as e: except Exception as e:
logger.debug(e, exc_info=1) logger.debug(e, exc_info=1)
message = e.message print("ERROR: %s" % strutils.six.text_type(e), file=sys.stderr)
if not isinstance(message, six.string_types):
message = str(message)
print("ERROR: %s" % strutils.safe_encode(message), file=sys.stderr)
sys.exit(1) sys.exit(1)