rename old config object to TempestConfigPrivate

this attempts to make it clear to folks they should not be calling
this directly. The proxy is needed for lazy evaluation, so don't
call this.

Fix one issue where a config addition was landed before we got this
in tree.

Change-Id: I16eeee12aec4994c31a8bafdf12c7eddc98dff18
This commit is contained in:
Sean Dague 2013-12-20 17:04:54 -05:00
parent 36cb048686
commit 3b9b1f3d34
3 changed files with 9 additions and 6 deletions

View File

@ -19,13 +19,15 @@ import testtools
from tempest.api.compute import base from tempest.api.compute import base
from tempest.common.utils.linux.remote_client import RemoteClient from tempest.common.utils.linux.remote_client import RemoteClient
import tempest.config from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class AttachVolumeV3TestJSON(base.BaseV3ComputeTest): class AttachVolumeV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json' _interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh run_ssh = CONF.compute.run_ssh
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(AttachVolumeV3TestJSON, self).__init__(*args, **kwargs) super(AttachVolumeV3TestJSON, self).__init__(*args, **kwargs)

View File

@ -33,5 +33,5 @@ from tempest.openstack.common.config import generator
if __name__ == "__main__": if __name__ == "__main__":
CONF = tempest.config.TempestConfig() CONF = tempest.config.TempestConfigPrivate()
generator.generate(sys.argv[1:]) generator.generate(sys.argv[1:])

View File

@ -644,7 +644,8 @@ DebugGroup = [
] ]
class TempestConfig(object): # this should never be called outside of this class
class TempestConfigPrivate(object):
"""Provides OpenStack configuration information.""" """Provides OpenStack configuration information."""
DEFAULT_CONFIG_DIR = os.path.join( DEFAULT_CONFIG_DIR = os.path.join(
@ -655,7 +656,7 @@ class TempestConfig(object):
def __init__(self): def __init__(self):
"""Initialize a configuration from a conf directory and conf file.""" """Initialize a configuration from a conf directory and conf file."""
super(TempestConfig, self).__init__() super(TempestConfigPrivate, self).__init__()
config_files = [] config_files = []
failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
@ -740,7 +741,7 @@ class TempestConfigProxy(object):
def __getattr__(self, attr): def __getattr__(self, attr):
if not self._config: if not self._config:
self._config = TempestConfig() self._config = TempestConfigPrivate()
return getattr(self._config, attr) return getattr(self._config, attr)