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
This commit is contained in:
Christian Schwede 2014-11-25 13:11:51 +01:00
parent 025da14326
commit 47546eb145

@ -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.''')