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
This commit is contained in:
parent
31842b6f3d
commit
4925ac2e3e
|
@ -19,13 +19,13 @@ import six
|
||||||
|
|
||||||
from openstack import connection
|
from openstack import connection
|
||||||
from openstack import exceptions as sdk_exc
|
from openstack import exceptions as sdk_exc
|
||||||
from openstack import profile
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from requests import exceptions as req_exc
|
from requests import exceptions as req_exc
|
||||||
|
|
||||||
from bilean.common import exception as bilean_exc
|
from bilean.common import exception as bilean_exc
|
||||||
|
from bilean import version
|
||||||
|
|
||||||
USER_AGENT = 'bilean'
|
APP_NAME = 'bilean'
|
||||||
exc = sdk_exc
|
exc = sdk_exc
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -96,18 +96,15 @@ def create_connection(params=None):
|
||||||
params = {}
|
params = {}
|
||||||
|
|
||||||
if params.get('token'):
|
if params.get('token'):
|
||||||
auth_plugin = 'token'
|
auth_type = 'token'
|
||||||
else:
|
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:
|
try:
|
||||||
conn = connection.Connection(profile=prof, user_agent=USER_AGENT,
|
conn = connection.Connection(
|
||||||
auth_plugin=auth_plugin, **params)
|
app_name=APP_NAME,
|
||||||
|
app_version=version.version_info.version_string(),
|
||||||
|
identity_api_version='3', auth_type=auth_type, **params)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise parse_exception(ex)
|
raise parse_exception(ex)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue