From c3c6edbe8a083aef0fb6aea3cb461ff8e715fc59 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Thu, 9 Oct 2014 15:16:07 -0500 Subject: Add plugin to support token-endpoint auth The ksc auth plugins do not have support for the original token-endpoint (aka token flow) auth where the user supplies a token (possibly the Keystone admin_token) and an API endpoint. This is used for bootstrapping Keystone but also has other uses when a scoped user token is provided. The api.auth:TokenEndpoint class is required to provide the same interface methods so all of the special-case code branches to support token-endpoint can be removed. Some additional cleanups related to ClientManager and creating the Compute client also were done to streamline using sessions. Change-Id: I1a6059afa845a591eff92567ca346c09010a93af --- openstackclient/compute/client.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py index dc50507e..6c03d24e 100644 --- a/openstackclient/compute/client.py +++ b/openstackclient/compute/client.py @@ -44,33 +44,20 @@ def make_client(instance): extensions = [extension.Extension('list_extensions', list_extensions)] client = compute_client( - username=instance._username, - api_key=instance._password, - project_id=instance._project_name, - auth_url=instance._auth_url, - cacert=instance._cacert, - insecure=instance._insecure, - region_name=instance._region_name, - # FIXME(dhellmann): get endpoint_type from option? - endpoint_type='publicURL', + session=instance.session, extensions=extensions, - service_type=API_NAME, - # FIXME(dhellmann): what is service_name? - service_name='', http_log_debug=http_log_debug, timings=instance.timing, ) # Populate the Nova client to skip another auth query to Identity - if instance._url: - # token flow - client.client.management_url = instance._url - else: + if 'token' not in instance._auth_params: # password flow client.client.management_url = instance.get_endpoint_for_service_type( API_NAME) client.client.service_catalog = instance._service_catalog - client.client.auth_token = instance._token + client.client.auth_token = instance.auth.get_token(instance.session) + return client -- cgit v1.2.1