diff options
author | JingLu5 <lvjing5@huawei.com> | 2016-12-13 05:42:41 +0000 |
---|---|---|
committer | JingLu5 <lvjing5@huawei.com> | 2016-12-13 12:13:06 +0000 |
commit | 99736a3882982aef0776f80056202ee745eb3fa4 (patch) | |
tree | d1dbbe7cab86e53eabc2f8483fcf815e07115260 /yardstick/orchestrator | |
parent | 3c3ac5d9e89af36bb609017e69f6d03b52d8b251 (diff) |
Add support for OpenSrack Newton
JIRA: YARDSTICK-410
This patch uses keystoneauth1.session to initialize the client for Heat
The keystoneauth1.session.Session class was introduced into keystoneauth1
as an attempt to bring a unified interface to the various OpenStack clients
that share common authentication and request parameters between a variety of
services.
Change-Id: Ie6287b50a36cf03950fa1174791df826e9bdafd3
Signed-off-by: JingLu5 <lvjing5@huawei.com>
Diffstat (limited to 'yardstick/orchestrator')
-rw-r--r-- | yardstick/orchestrator/heat.py | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index f3a191503..4839455e1 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -7,10 +7,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -""" Heat template and stack management -""" +"""Heat template and stack management""" -import os import time import datetime import getpass @@ -18,10 +16,11 @@ import socket import logging import pkg_resources import json -import heatclient.client -import keystoneclient + +import heatclient from yardstick.common import template_format +import yardstick.common.openstack_utils as op_utils log = logging.getLogger(__name__) @@ -30,32 +29,18 @@ log = logging.getLogger(__name__) class HeatObject(object): ''' base class for template and stack''' def __init__(self): - self._keystone_client = None self._heat_client = None self.uuid = None - def _get_keystone_client(self): - '''returns a keystone client instance''' - - if self._keystone_client is None: - self._keystone_client = keystoneclient.v2_0.client.Client( - auth_url=os.environ.get('OS_AUTH_URL'), - username=os.environ.get('OS_USERNAME'), - password=os.environ.get('OS_PASSWORD'), - tenant_name=os.environ.get('OS_TENANT_NAME'), - cacert=os.environ.get('OS_CACERT')) - - return self._keystone_client - def _get_heat_client(self): '''returns a heat client instance''' if self._heat_client is None: - keystone = self._get_keystone_client() - heat_endpoint = keystone.service_catalog.url_for( - service_type='orchestration') + sess = op_utils.get_session() + heat_endpoint = op_utils.get_endpoint(service_type='orchestration') self._heat_client = heatclient.client.Client( - '1', endpoint=heat_endpoint, token=keystone.auth_token) + op_utils.get_heat_api_version(), + endpoint=heat_endpoint, session=sess) return self._heat_client |