Remove CONF values from object_storage clients
To move object_storage clients to tempest-lib, this patch moves
CONF values from object_storage clients to the client setting.
Change-Id: I0fabc1036bcf8ce2e96ac946a6fe1d67deee140d
diff --git a/tempest/clients.py b/tempest/clients.py
index 32c6410..aa6d3ed 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -314,9 +314,16 @@
self.auth_provider)
def _set_object_storage_clients(self):
- self.account_client = AccountClient(self.auth_provider)
- self.container_client = ContainerClient(self.auth_provider)
- self.object_client = ObjectClient(self.auth_provider)
+ params = {
+ 'service': CONF.object_storage.catalog_type,
+ 'region': CONF.object_storage.region or CONF.identity.region,
+ 'endpoint_type': CONF.object_storage.endpoint_type
+ }
+ params.update(self.default_params_with_timeout_values)
+
+ self.account_client = AccountClient(self.auth_provider, **params)
+ self.container_client = ContainerClient(self.auth_provider, **params)
+ self.object_client = ObjectClient(self.auth_provider, **params)
class AdminManager(Manager):
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index e5ffb1b..1591c59 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -159,6 +159,13 @@
}
compute_params.update(default_params)
+ object_storage_params = {
+ 'service': CONF.object_storage.catalog_type,
+ 'region': CONF.object_storage.region or CONF.identity.region,
+ 'endpoint_type': CONF.object_storage.endpoint_type
+ }
+ object_storage_params.update(default_params)
+
_creds = tempest.auth.KeystoneV2Credentials(
username=user,
password=pw,
@@ -171,8 +178,10 @@
**compute_params)
self.secgroups = security_groups_client.SecurityGroupsClientJSON(
_auth, **compute_params)
- self.objects = object_client.ObjectClient(_auth)
- self.containers = container_client.ContainerClient(_auth)
+ self.objects = object_client.ObjectClient(_auth,
+ **object_storage_params)
+ self.containers = container_client.ContainerClient(
+ _auth, **object_storage_params)
self.images = image_client.ImageClientV2JSON(_auth)
self.telemetry = telemetry_client.TelemetryClientJSON(_auth)
self.volumes = volumes_client.VolumesClientJSON(_auth)
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index c24bbba..af00eff 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -17,13 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest import config
-from tempest.services.object_storage import base
-
-CONF = config.CONF
+from tempest.common import service_client
-class AccountClient(base.ObjectStorageClient):
+class AccountClient(service_client.ServiceClient):
def create_account(self, data=None,
params=None,
diff --git a/tempest/services/object_storage/base.py b/tempest/services/object_storage/base.py
deleted file mode 100644
index 1e7355e..0000000
--- a/tempest/services/object_storage/base.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2014 NEC Corporation. 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.
-
-from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class ObjectStorageClient(service_client.ServiceClient):
- """
- Base object storage client class
- """
-
- def __init__(self, auth_provider):
- super(ObjectStorageClient, self).__init__(
- auth_provider,
- CONF.object_storage.catalog_type,
- CONF.object_storage.region or CONF.identity.region,
- endpoint_type=CONF.object_storage.endpoint_type)
- self.format = 'json'
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index c55826b..ed74de4 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -17,10 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest.services.object_storage import base
+from tempest.common import service_client
-class ContainerClient(base.ObjectStorageClient):
+class ContainerClient(service_client.ServiceClient):
def create_container(
self, container_name,
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index bb74fd7..eaa894d 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -17,13 +17,10 @@
import urllib
import urlparse
-from tempest import config
-from tempest.services.object_storage import base
-
-CONF = config.CONF
+from tempest.common import service_client
-class ObjectClient(base.ObjectStorageClient):
+class ObjectClient(service_client.ServiceClient):
def create_object(self, container, object_name, data,
params=None, metadata=None, headers=None):
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index fc73c18..c8fe7b7 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -44,6 +44,9 @@
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
from tempest.services.network.json import network_client
+from tempest.services.object_storage import account_client
+from tempest.services.object_storage import container_client
+from tempest.services.object_storage import object_client
from tempest.services.orchestration.json import orchestration_client
from tempest.tests import base
@@ -81,6 +84,9 @@
db_flavor_client.DatabaseFlavorsClientJSON,
db_version_client.DatabaseVersionsClientJSON,
network_client.NetworkClientJSON,
+ account_client.AccountClient,
+ container_client.ContainerClient,
+ object_client.ObjectClient,
orchestration_client.OrchestrationClient]
for client in test_clients: