diff options
| author | Chuck Short <chuck.short@canonical.com> | 2013-06-21 07:15:11 -0500 |
|---|---|---|
| committer | Chuck Short <chuck.short@canonical.com> | 2013-06-22 12:50:23 -0500 |
| commit | 1197fb3701641663c86c678c27708b6bf71c7062 (patch) | |
| tree | 49c9f20d684b76ba510ef39a7ba37cc26c945f6c /cinderclient/shell.py | |
| parent | bbf791a1f50a28f22a76cdd9ede85c913476a1fe (diff) | |
| download | python-cinderclient-1197fb3701641663c86c678c27708b6bf71c7062.tar.gz | |
python3: Strutils is not needed
strutils is used to safely encode and decode unicode strings
for python2.7. Since unicode strings are the default in python3,
ignore the use of strutils when running with python3.
Change-Id: I9a8e296b4f2153b1ef4302a7dcd797fbb4561c35
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'cinderclient/shell.py')
| -rw-r--r-- | cinderclient/shell.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cinderclient/shell.py b/cinderclient/shell.py index 9750d2f..d7377b1 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -29,6 +29,8 @@ import pkgutil import sys import logging +import six + from cinderclient import client from cinderclient import exceptions as exc import cinderclient.extension @@ -500,14 +502,18 @@ class OpenStackHelpFormatter(argparse.HelpFormatter): def main(): try: - OpenStackCinderShell().main(map(strutils.safe_decode, sys.argv[1:])) + if sys.version_info >= (3, 0): + OpenStackCinderShell().main(sys.argv[1:]) + else: + OpenStackCinderShell().main(map(strutils.safe_decode, + sys.argv[1:])) except KeyboardInterrupt: print("... terminating cinder client", file=sys.stderr) sys.exit(130) except Exception as e: logger.debug(e, exc_info=1) message = e.message - if not isinstance(message, basestring): + if not isinstance(message, six.string_types): message = str(message) print("ERROR: %s" % strutils.safe_encode(message), file=sys.stderr) sys.exit(1) |
