From fa4a4a37d6ce931a9832677dea1edffd228300a4 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Thu, 10 May 2012 16:25:31 -0500 Subject: Move get_client_class() to common.utils * add constants for API_NAME Change-Id: I8ccf72f032227e0a452d96303181549b1b11a5d1 --- openstackclient/compute/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py index fa37ff55..a59b6e00 100644 --- a/openstackclient/compute/client.py +++ b/openstackclient/compute/client.py @@ -21,13 +21,15 @@ from novaclient import client as nova_client LOG = logging.getLogger(__name__) +API_NAME = 'compute' + def make_client(instance): """Returns a compute service client. """ LOG.debug('instantiating compute client') client = nova_client.Client( - version=instance._api_version['compute'], + version=instance._api_version[API_NAME], username=instance._username, api_key=instance._password, project_id=instance._tenant_name, @@ -39,7 +41,7 @@ def make_client(instance): endpoint_type='publicURL', # FIXME(dhellmann): add extension discovery extensions=[], - service_type='compute', + service_type=API_NAME, # FIXME(dhellmann): what is service_name? service_name='', ) @@ -51,7 +53,7 @@ def make_client(instance): else: # password flow client.client.management_url = instance.get_endpoint_for_service_type( - 'compute') + API_NAME) client.client.service_catalog = instance._service_catalog client.client.auth_token = instance._token return client -- cgit v1.2.1