Print useful message when keystoneclient is not installed

client.py now prints a useful message when trying to use Auth version
2.0 and keystoneclient is not installed.

Fixes bug 1102322

Change-Id: I6ed83610fd6e8c79c2dc5cf05db377a843cab1d5
This commit is contained in:
Flaper Fesp 2013-01-21 10:20:06 +01:00
parent b5f222b5d6
commit 4ac431a9a2
2 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@ Cloud Files client library used internally
import socket
import os
import sys
import logging
from functools import wraps
@ -240,8 +241,15 @@ def get_keystoneclient_2_0(auth_url, user, key, os_options, **kwargs):
insecure = kwargs.get('insecure', False)
debug = logger.isEnabledFor(logging.DEBUG) and True or False
from keystoneclient.v2_0 import client as ksclient
from keystoneclient import exceptions
try:
from keystoneclient.v2_0 import client as ksclient
from keystoneclient import exceptions
except ImportError:
sys.exit('''
Auth version 2.0 requires 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.''')
try:
_ksclient = ksclient.Client(username=user,
password=key,

View File

@ -1 +1 @@
simplejson
simplejson