diff options
| author | Artem Goncharov <artem.goncharov@gmail.com> | 2019-12-17 14:43:21 +0100 |
|---|---|---|
| committer | Monty Taylor <mordred@inaugust.com> | 2020-03-24 13:13:06 +0000 |
| commit | 768a64aac5bd14f56c142faeec1793aac91947cb (patch) | |
| tree | 1a98b8a5e96b7be7ee6c6442f7b59864efd3890f /openstackclient/image/client.py | |
| parent | 60e7c51df4cf061ebbb435a959ad63c7d3a296bf (diff) | |
| download | python-openstackclient-768a64aac5bd14f56c142faeec1793aac91947cb.tar.gz | |
Complete switch from glanceclient to SDK for image service
In https://review.opendev.org/#/c/650374/ a work has been started to
switch image service support from glanceclient with all it's
dependencies to the SDK version. With this change version 1 (anyway
deprecated since ages) is also being switched to SDK.
Change-Id: Ic391500af02a73d81d64a9e9113cca85c9e24390
Diffstat (limited to 'openstackclient/image/client.py')
| -rw-r--r-- | openstackclient/image/client.py | 58 |
1 files changed, 6 insertions, 52 deletions
diff --git a/openstackclient/image/client.py b/openstackclient/image/client.py index 15bea17e..9a0d7bac 100644 --- a/openstackclient/image/client.py +++ b/openstackclient/image/client.py @@ -26,64 +26,18 @@ DEFAULT_API_VERSION = '2' API_VERSION_OPTION = 'os_image_api_version' API_NAME = "image" API_VERSIONS = { - "1": "glanceclient.v1.client.Client", + "1": "openstack.connection.Connection", "2": "openstack.connection.Connection", } -IMAGE_API_TYPE = 'image' -IMAGE_API_VERSIONS = { - '1': 'openstackclient.api.image_v1.APIv1', - '2': 'openstackclient.api.image_v2.APIv2', -} - def make_client(instance): - if instance._api_version[API_NAME] != '1': - LOG.debug( - 'Image client initialized using OpenStack SDK: %s', - instance.sdk_connection.image, - ) - return instance.sdk_connection.image - else: - """Returns an image service client""" - image_client = utils.get_client_class( - API_NAME, - instance._api_version[API_NAME], - API_VERSIONS) - LOG.debug('Instantiating image client: %s', image_client) - - endpoint = instance.get_endpoint_for_service_type( - API_NAME, - region_name=instance.region_name, - interface=instance.interface, - ) - - client = image_client( - endpoint, - token=instance.auth.get_token(instance.session), - cacert=instance.cacert, - insecure=not instance.verify, - ) - - # Create the low-level API - - image_api = utils.get_client_class( - API_NAME, - instance._api_version[API_NAME], - IMAGE_API_VERSIONS) - LOG.debug('Instantiating image api: %s', image_api) - - client.api = image_api( - session=instance.session, - endpoint=instance.get_endpoint_for_service_type( - IMAGE_API_TYPE, - region_name=instance.region_name, - interface=instance.interface, - ) - ) - - return client + LOG.debug( + 'Image client initialized using OpenStack SDK: %s', + instance.sdk_connection.image, + ) + return instance.sdk_connection.image def build_option_parser(parser): |
