Service client modules in image __init__

Import the image service client classes in the __init__ of the
image module, and define __all__, so that service client classes
may be accessed by importing the image module only.

Change-Id: Ieb4590acd3029dfcc94c48cf85f8fbee9a4f1da7
Partially-implements: bp client-manager-refactor
This commit is contained in:
Andrea Frittoli (andreaf) 2016-06-17 12:14:00 +01:00 committed by Andrea Frittoli
parent 14ecae147a
commit 26300f9bd3
4 changed files with 69 additions and 18 deletions

View File

@ -21,16 +21,6 @@ from tempest.common import negative_rest_client
from tempest import config
from tempest import exceptions
from tempest.lib.services import compute
from tempest.lib.services.image.v1.image_members_client import \
ImageMembersClient
from tempest.lib.services.image.v2.image_members_client import \
ImageMembersClient as ImageMembersClientV2
from tempest.lib.services.image.v2.images_client import \
ImagesClient as ImagesV2Client
from tempest.lib.services.image.v2.namespaces_client import NamespacesClient
from tempest.lib.services.image.v2.resource_types_client import \
ResourceTypesClient
from tempest.lib.services.image.v2.schemas_client import SchemasClient
from tempest.lib.services import network
from tempest import manager
from tempest.services.baremetal.v1.json.baremetal_client import \
@ -44,7 +34,7 @@ from tempest.services.database.json.limits_client import \
from tempest.services.database.json.versions_client import \
DatabaseVersionsClient
from tempest.services import identity
from tempest.services.image.v1.json.images_client import ImagesClient
from tempest.services import image
from tempest.services.object_storage.account_client import AccountClient
from tempest.services.object_storage.container_client import ContainerClient
from tempest.services.object_storage.object_client import ObjectClient
@ -163,19 +153,19 @@ class Manager(manager.Manager):
params.update(self.default_params)
if CONF.service_available.glance:
self.image_client = ImagesClient(
self.image_client = image.v1.ImagesClient(
self.auth_provider, **params)
self.image_member_client = ImageMembersClient(
self.image_member_client = image.v1.ImageMembersClient(
self.auth_provider, **params)
self.image_client_v2 = ImagesV2Client(
self.image_client_v2 = image.v2.ImagesClient(
self.auth_provider, **params)
self.image_member_client_v2 = ImageMembersClientV2(
self.image_member_client_v2 = image.v2.ImageMembersClient(
self.auth_provider, **params)
self.namespaces_client = NamespacesClient(
self.namespaces_client = image.v2.NamespacesClient(
self.auth_provider, **params)
self.resource_types_client = ResourceTypesClient(
self.resource_types_client = image.v2.ResourceTypesClient(
self.auth_provider, **params)
self.schemas_client = SchemasClient(
self.schemas_client = image.v2.SchemasClient(
self.auth_provider, **params)
def _set_compute_clients(self):

View File

@ -0,0 +1,24 @@
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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.
from tempest.lib.services.image.v2.image_members_client import \
ImageMembersClient
from tempest.lib.services.image.v2.images_client import ImagesClient
from tempest.lib.services.image.v2.namespaces_client import NamespacesClient
from tempest.lib.services.image.v2.resource_types_client import \
ResourceTypesClient
from tempest.lib.services.image.v2.schemas_client import SchemasClient
__all__ = ['ImageMembersClient', 'ImagesClient', 'NamespacesClient',
'ResourceTypesClient', 'SchemasClient']

View File

@ -0,0 +1,18 @@
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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.
from tempest.lib.services.image import v2
from tempest.services.image import v1
__all__ = ['v1', 'v2']

View File

@ -0,0 +1,19 @@
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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.
from tempest.lib.services.image.v1.image_members_client import \
ImageMembersClient
from tempest.services.image.v1.json.images_client import ImagesClient
__all__ = ['ImageMembersClient', 'ImagesClient']