Merge "Fix DeprecationWarning when printing exception"
This commit is contained in:
commit
728a3419c9
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user