
Currently python-manilaclient doesn't support keystone sessions unlike to others clients. keystoneclient.session.Session gives end-user possibility to share common authentication and request parameters between a variety of services. - Add python-keystoneclient to requirements.txt - Move authentication logic to v1/client.py - Move HttpClient to separate module - Simplify SecretsHelper in shell.py - Replace service_catalog module by keystoneclient.service_catalog - Add appropriate unit tests Implements bp add-keystone-session-support Change-Id: I7d1c50fa31d9e2f32bb518a78a02bc12b114d0ab
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
# Copyright 2010 Jacob Kaplan-Moss
|
|
# Copyright 2011 OpenStack LLC.
|
|
# Copyright 2011 Piston Cloud Computing, Inc.
|
|
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
"""
|
|
OpenStack Client interface. Handles the REST calls and responses.
|
|
"""
|
|
|
|
from oslo.utils import importutils
|
|
|
|
from manilaclient import exceptions
|
|
|
|
|
|
def get_client_class(version):
|
|
version_map = {
|
|
'1': 'manilaclient.v1.client.Client',
|
|
}
|
|
try:
|
|
client_path = version_map[str(version)]
|
|
except (KeyError, ValueError):
|
|
msg = "Invalid client version '%s'. must be one of: %s" % (
|
|
(version, ', '.join(version_map)))
|
|
raise exceptions.UnsupportedVersion(msg)
|
|
|
|
return importutils.import_class(client_path)
|
|
|
|
|
|
def Client(version, *args, **kwargs):
|
|
client_class = get_client_class(version)
|
|
return client_class(*args, **kwargs)
|