From 3b9b1f3d349f230e333dd1bbef6d23dd0d83fddf Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 20 Dec 2013 17:04:54 -0500 Subject: [PATCH] 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 --- tempest/api/compute/v3/servers/test_attach_volume.py | 6 ++++-- tempest/common/generate_sample_tempest.py | 2 +- tempest/config.py | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tempest/api/compute/v3/servers/test_attach_volume.py b/tempest/api/compute/v3/servers/test_attach_volume.py index 4da527c1b1..a0305841f4 100644 --- a/tempest/api/compute/v3/servers/test_attach_volume.py +++ b/tempest/api/compute/v3/servers/test_attach_volume.py @@ -19,13 +19,15 @@ import testtools from tempest.api.compute import base from tempest.common.utils.linux.remote_client import RemoteClient -import tempest.config +from tempest import config from tempest.test import attr +CONF = config.CONF + class AttachVolumeV3TestJSON(base.BaseV3ComputeTest): _interface = 'json' - run_ssh = tempest.config.TempestConfig().compute.run_ssh + run_ssh = CONF.compute.run_ssh def __init__(self, *args, **kwargs): super(AttachVolumeV3TestJSON, self).__init__(*args, **kwargs) diff --git a/tempest/common/generate_sample_tempest.py b/tempest/common/generate_sample_tempest.py index 22be4aa257..71e04f0264 100644 --- a/tempest/common/generate_sample_tempest.py +++ b/tempest/common/generate_sample_tempest.py @@ -33,5 +33,5 @@ from tempest.openstack.common.config import generator if __name__ == "__main__": - CONF = tempest.config.TempestConfig() + CONF = tempest.config.TempestConfigPrivate() generator.generate(sys.argv[1:]) diff --git a/tempest/config.py b/tempest/config.py index 140c5219cf..a51c3800eb 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -644,7 +644,8 @@ DebugGroup = [ ] -class TempestConfig(object): +# this should never be called outside of this class +class TempestConfigPrivate(object): """Provides OpenStack configuration information.""" DEFAULT_CONFIG_DIR = os.path.join( @@ -655,7 +656,7 @@ class TempestConfig(object): def __init__(self): """Initialize a configuration from a conf directory and conf file.""" - super(TempestConfig, self).__init__() + super(TempestConfigPrivate, self).__init__() config_files = [] failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE @@ -740,7 +741,7 @@ class TempestConfigProxy(object): def __getattr__(self, attr): if not self._config: - self._config = TempestConfig() + self._config = TempestConfigPrivate() return getattr(self._config, attr)