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
This commit is contained in:
Matthew Treinish 2014-01-30 16:51:06 +00:00
parent 11108cfb3b
commit bc0e03ef6a
5 changed files with 18 additions and 24 deletions

View File

@ -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 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@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)

View File

@ -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 @@ class VolumesGetTestJSON(base.BaseV2ComputeTest):
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)

View File

@ -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 @@ class CreateRegisterImagesTest(base.BaseV1ImageTest):
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'))

View File

@ -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 @@ class Manager(object):
"""
def __init__(self):
self.config = config.CONF
self.client_attr_names = []
# we do this everywhere, have it be part of the super class

View File

@ -155,13 +155,12 @@ def is_extension_enabled(extension_name, service):
"""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 @@ class BaseTestCase(testtools.TestCase,
testtools.testcase.WithAttributes,
testresources.ResourcedTestCase):
config = CONF
setUpClassCalled = False
network_resources = {}
@ -281,7 +278,7 @@ class BaseTestCase(testtools.TestCase,
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
@ -310,16 +307,6 @@ class BaseTestCase(testtools.TestCase,
admin_client = os.identity_client
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):