From 6fb1a4e496f6860c800f08e68c05b7e95be36c3b Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 9 May 2012 17:15:43 -0500 Subject: More identity client config * move auth option checking back to OpenStackShell() to keep the shell-level interaction at that level; add checking for token flow options * make identity.client.make_client() configure keystoneclient.v2_0.Client() properly for both password flow and token flow auth * eliminated ClientManager.init_token(), set _service_catalog in __init__() * compute client handles token flow Change-Id: I42481b5424489387798c4ec6d3e2a723ab1e6067 --- openstackclient/identity/client.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'openstackclient/identity') diff --git a/openstackclient/identity/client.py b/openstackclient/identity/client.py index be44098e..2d823d2b 100644 --- a/openstackclient/identity/client.py +++ b/openstackclient/identity/client.py @@ -8,13 +8,20 @@ LOG = logging.getLogger(__name__) def make_client(instance): """Returns an identity service client. """ - LOG.debug('instantiating identity client') - client = identity_client.Client( - username=instance._username, - password=instance._password, - tenant_name=instance._tenant_name, - tenant_id=instance._tenant_id, - auth_url=instance._auth_url, - region_name=instance._region_name, - ) + if instance._url: + LOG.debug('instantiating identity client: token flow') + client = identity_client.Client( + endpoint=instance._url, + token=instance._token, + ) + else: + LOG.debug('instantiating identity client: password flow') + client = identity_client.Client( + username=instance._username, + password=instance._password, + tenant_name=instance._tenant_name, + tenant_id=instance._tenant_id, + auth_url=instance._auth_url, + region_name=instance._region_name, + ) return client -- cgit v1.2.1