diff options
Diffstat (limited to 'openstackclient/identity/client.py')
| -rw-r--r-- | openstackclient/identity/client.py | 25 |
1 files changed, 16 insertions, 9 deletions
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 |
