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
diff --git a/tempest/api/compute/v3/servers/test_attach_volume.py b/tempest/api/compute/v3/servers/test_attach_volume.py
index 4da527c..a030584 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 @@
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 22be4aa..71e04f0 100644
--- a/tempest/common/generate_sample_tempest.py
+++ b/tempest/common/generate_sample_tempest.py
@@ -33,5 +33,5 @@
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 140c521..a51c380 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -644,7 +644,8 @@
]
-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 @@
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 @@
def __getattr__(self, attr):
if not self._config:
- self._config = TempestConfig()
+ self._config = TempestConfigPrivate()
return getattr(self._config, attr)