diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 928ab6eea6..336c0da0e9 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -106,9 +106,6 @@ class ClientManager(object): self.auth_ref = self.auth.get_auth_ref(self.session) self._service_catalog = self.auth_ref.service_catalog - # This begone when clients no longer need it... - self._token = self.auth.get_token(self.session) - return def get_endpoint_for_service_type(self, service_type, region_name=None): diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py index ff9ed88a0a..c87bbee700 100644 --- a/openstackclient/compute/client.py +++ b/openstackclient/compute/client.py @@ -43,6 +43,7 @@ def make_client(instance): http_log_debug = utils.get_effective_log_level() <= logging.DEBUG extensions = [extension.Extension('list_extensions', list_extensions)] + client = compute_client( session=instance.session, extensions=extensions, @@ -50,14 +51,6 @@ def make_client(instance): timings=instance.timing, ) - # Populate the Nova client to skip another auth query to Identity - if 'token' not in instance._auth_params: - # password flow - client.client.management_url = instance.get_endpoint_for_service_type( - API_NAME, region_name=instance._region_name) - client.client.service_catalog = instance._service_catalog - client.client.auth_token = instance.auth.get_token(instance.session) - return client diff --git a/openstackclient/image/client.py b/openstackclient/image/client.py index a23d349e01..84f5943754 100644 --- a/openstackclient/image/client.py +++ b/openstackclient/image/client.py @@ -45,7 +45,7 @@ def make_client(instance): return image_client( instance._url, - token=instance._token, + token=instance.auth.get_token(instance.session), cacert=instance._cacert, insecure=instance._insecure, ) diff --git a/openstackclient/network/client.py b/openstackclient/network/client.py index 870fdad1db..e4ce2f6a08 100644 --- a/openstackclient/network/client.py +++ b/openstackclient/network/client.py @@ -44,7 +44,7 @@ def make_client(instance): region_name=instance._region_name, auth_url=instance._auth_url, endpoint_url=instance._url, - token=instance._token, + token=instance.auth.get_token(instance.session), insecure=instance._insecure, ca_cert=instance._cacert, ) diff --git a/openstackclient/tests/common/test_clientmanager.py b/openstackclient/tests/common/test_clientmanager.py index d0738c79bf..24adfa0e0b 100644 --- a/openstackclient/tests/common/test_clientmanager.py +++ b/openstackclient/tests/common/test_clientmanager.py @@ -89,10 +89,9 @@ class TestClientManager(utils.TestCase): fakes.AUTH_URL, client_manager._url, ) - self.assertEqual( fakes.AUTH_TOKEN, - client_manager._token, + client_manager.auth.get_token(None), ) self.assertIsInstance( client_manager.auth, @@ -111,10 +110,6 @@ class TestClientManager(utils.TestCase): verify=True ) - self.assertEqual( - fakes.AUTH_TOKEN, - client_manager._token, - ) self.assertEqual( fakes.AUTH_URL, client_manager._auth_url, @@ -160,10 +155,6 @@ class TestClientManager(utils.TestCase): AUTH_REF, client_manager.auth_ref, ) - self.assertEqual( - fakes.AUTH_TOKEN, - client_manager._token, - ) self.assertEqual( dir(SERVICE_CATALOG), dir(client_manager._service_catalog), diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py index 58cb267e53..f4e2decb35 100644 --- a/openstackclient/volume/client.py +++ b/openstackclient/volume/client.py @@ -49,29 +49,13 @@ def make_client(instance): http_log_debug = utils.get_effective_log_level() <= logging.DEBUG extensions = [extension.Extension('list_extensions', list_extensions)] + client = volume_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, + session=instance.session, extensions=extensions, http_log_debug=http_log_debug, ) - # Populate the Cinder client to skip another auth query to Identity - if instance._url: - # token flow - client.client.management_url = instance._url - else: - # password flow - client.client.management_url = instance.get_endpoint_for_service_type( - API_NAME, region_name=instance._region_name) - client.client.service_catalog = instance._service_catalog - client.client.auth_token = instance._token - return client