summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schwede <christian.schwede@enovance.com>2014-11-25 13:11:51 +0100
committerChristian Schwede <christian.schwede@enovance.com>2014-11-25 13:15:08 +0100
commit47546eb14522b70ebb765986560d914a88916276 (patch)
tree869ed027330a9cbdb4cd42aed1608f4156a8b1eb
parent025da14326d29051119fff50424748e41bf4be42 (diff)
downloadpython-swiftclient-47546eb14522b70ebb765986560d914a88916276.tar.gz
Show warning when auth_version >= 2 and keystoneclient is missing
Swiftclient hangs forever without any reasonable hint if someone uses a recent version of swiftclient together with auth version 2 or later. The reason for this is the sys.exit() call in a thread - the main thread never exists, and swift just waits forever. Raising a ClientException instead of calling sys.exit() fixes this and returns the desired information back to the user. Change-Id: I1fdff85da2dd4b883d337d6098b1695e448d6f2b
-rw-r--r--swiftclient/client.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py
index 8cbedc7..c355c3f 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -19,7 +19,6 @@ OpenStack Swift client library used internally
import socket
import requests
-import sys
import logging
import warnings
import functools
@@ -296,7 +295,7 @@ def _import_keystone_client(auth_version):
from keystoneclient import exceptions
return ksclient, exceptions
except ImportError:
- sys.exit('''
+ raise ClientException('''
Auth versions 2.0 and 3 require python-keystoneclient, install it or use Auth
version 1.0 which requires ST_AUTH, ST_USER, and ST_KEY environment
variables to be set or overridden with -A, -U, or -K.''')