From 47546eb14522b70ebb765986560d914a88916276 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Tue, 25 Nov 2014 13:11:51 +0100 Subject: 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 --- swiftclient/client.py | 3 +-- 1 file changed, 1 insertion(+), 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.''') -- cgit v1.2.1