From 4925ac2e3ea452bfe68c79a6e70dde183cf0c5e6 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 4 Feb 2018 10:28:56 -0600 Subject: [PATCH] Update use of SDK for 0.11 OpenStackSDK is moving away from Profile due to the merge with os-client-config. Update the constructor to use the new form. Change-Id: I1fff1b2094444bd013f9e436edae7921ffd6d71a --- bilean/drivers/openstack/sdk.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bilean/drivers/openstack/sdk.py b/bilean/drivers/openstack/sdk.py index 2de6148..a273230 100644 --- a/bilean/drivers/openstack/sdk.py +++ b/bilean/drivers/openstack/sdk.py @@ -19,13 +19,13 @@ import six from openstack import connection from openstack import exceptions as sdk_exc -from openstack import profile from oslo_serialization import jsonutils from requests import exceptions as req_exc from bilean.common import exception as bilean_exc +from bilean import version -USER_AGENT = 'bilean' +APP_NAME = 'bilean' exc = sdk_exc LOG = logging.getLogger(__name__) @@ -96,18 +96,15 @@ def create_connection(params=None): params = {} if params.get('token'): - auth_plugin = 'token' + auth_type = 'token' else: - auth_plugin = 'password' + auth_type = 'password' - prof = profile.Profile() - prof.set_version('identity', 'v3') - if 'region_name' in params: - prof.set_region(prof.ALL, params['region_name']) - params.pop('region_name') try: - conn = connection.Connection(profile=prof, user_agent=USER_AGENT, - auth_plugin=auth_plugin, **params) + conn = connection.Connection( + app_name=APP_NAME, + app_version=version.version_info.version_string(), + identity_api_version='3', auth_type=auth_type, **params) except Exception as ex: raise parse_exception(ex)