Remove last uses of config without global CONF object
This commit removes that last uses of config without using the global
CONF object.
Partially implements bp config-cleanup
Change-Id: Idc649993b7cd5a45282fde827b2b08f6fb19ab4d
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 89a2f75..4115d65 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -15,8 +15,11 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -24,7 +27,7 @@
@classmethod
def setUpClass(cls):
super(ImagesMetadataTestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index b5a4802..3fc7c55 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -15,9 +15,12 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
from testtools.matchers import ContainsAll
+CONF = config.CONF
+
class VolumesGetTestJSON(base.BaseV2ComputeTest):
@@ -27,7 +30,7 @@
def setUpClass(cls):
super(VolumesGetTestJSON, cls).setUpClass()
cls.client = cls.volumes_extensions_client
- if not cls.config.service_available.cinder:
+ if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 3c8d95e..8c62c05 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -16,8 +16,11 @@
import cStringIO as StringIO
from tempest.api.image import base
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class CreateRegisterImagesTest(base.BaseV1ImageTest):
"""Here we test the registration and creation of images."""
@@ -68,7 +71,7 @@
resp, body = self.create_image(name='New Http Image',
container_format='bare',
disk_format='raw', is_public=True,
- copy_from=self.config.images.http_image)
+ copy_from=CONF.images.http_image)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Http Image', body.get('name'))
diff --git a/tempest/manager.py b/tempest/manager.py
index cba6ba5..93ff10f 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config
from tempest import exceptions
@@ -27,7 +26,6 @@
"""
def __init__(self):
- self.config = config.CONF
self.client_attr_names = []
# we do this everywhere, have it be part of the super class
diff --git a/tempest/test.py b/tempest/test.py
index 6754831..5898358 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -155,13 +155,12 @@
"""A function that will check the list of enabled extensions from config
"""
- configs = CONF
config_dict = {
- 'compute': configs.compute_feature_enabled.api_extensions,
- 'compute_v3': configs.compute_feature_enabled.api_v3_extensions,
- 'volume': configs.volume_feature_enabled.api_extensions,
- 'network': configs.network_feature_enabled.api_extensions,
- 'object': configs.object_storage_feature_enabled.discoverable_apis,
+ 'compute': CONF.compute_feature_enabled.api_extensions,
+ 'compute_v3': CONF.compute_feature_enabled.api_v3_extensions,
+ 'volume': CONF.volume_feature_enabled.api_extensions,
+ 'network': CONF.network_feature_enabled.api_extensions,
+ 'object': CONF.object_storage_feature_enabled.discoverable_apis,
}
if config_dict[service][0] == 'all':
return True
@@ -224,8 +223,6 @@
testtools.testcase.WithAttributes,
testresources.ResourcedTestCase):
- config = CONF
-
setUpClassCalled = False
network_resources = {}
@@ -281,7 +278,7 @@
cls.__name__, network_resources=cls.network_resources)
force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None)
- if (cls.config.compute.allow_tenant_isolation or
+ if (CONF.compute.allow_tenant_isolation or
force_tenant_isolation):
creds = cls.isolated_creds.get_primary_creds()
username, tenant_name, password = creds
@@ -311,16 +308,6 @@
return admin_client
@classmethod
- def _get_client_args(cls):
-
- return (
- cls.config,
- cls.config.identity.admin_username,
- cls.config.identity.admin_password,
- cls.config.identity.uri
- )
-
- @classmethod
def set_network_resources(self, network=False, router=False, subnet=False,
dhcp=False):
"""Specify which network resources should be created