Fixes print error for keystone action with non-English characters
When processing keystone tenant-delete action with non-English characters, printing the exception traceback will result in a UnicodeEncodeError, so should encode text with safe_encode. Fixes bug #1231472 Change-Id: Ic2599c51513189c132e31aa87d0d15df81802688
This commit is contained in:
@@ -27,6 +27,7 @@ from __future__ import print_function
|
|||||||
import argparse
|
import argparse
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import keystoneclient
|
import keystoneclient
|
||||||
@@ -35,6 +36,7 @@ from keystoneclient import access
|
|||||||
from keystoneclient.contrib.bootstrap import shell as shell_bootstrap
|
from keystoneclient.contrib.bootstrap import shell as shell_bootstrap
|
||||||
from keystoneclient import exceptions as exc
|
from keystoneclient import exceptions as exc
|
||||||
from keystoneclient.generic import shell as shell_generic
|
from keystoneclient.generic import shell as shell_generic
|
||||||
|
from keystoneclient.openstack.common import strutils
|
||||||
from keystoneclient import utils
|
from keystoneclient import utils
|
||||||
from keystoneclient.v2_0 import shell as shell_v2_0
|
from keystoneclient.v2_0 import shell as shell_v2_0
|
||||||
|
|
||||||
@@ -488,7 +490,7 @@ def main():
|
|||||||
OpenStackIdentityShell().main(sys.argv[1:])
|
OpenStackIdentityShell().main(sys.argv[1:])
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, file=sys.stderr)
|
print(strutils.safe_encode(six.text_type(e)), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user