summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2012-05-10 16:25:31 -0500
committerDean Troyer <dtroyer@gmail.com>2012-05-11 13:49:45 -0500
commitfa4a4a37d6ce931a9832677dea1edffd228300a4 (patch)
treecc54f5d6db37cce400de5eab2128145135e8bfd9 /openstackclient/compute
parent5378322906a636bc2b9685e7403950549ef213f5 (diff)
downloadpython-openstackclient-fa4a4a37d6ce931a9832677dea1edffd228300a4.tar.gz
Move get_client_class() to common.utils
* add constants for API_NAME Change-Id: I8ccf72f032227e0a452d96303181549b1b11a5d1
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/client.py8
1 files changed, 5 insertions, 3 deletions
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