remove last errant file parse warning

provide a way to be able to instantiate the config object without
parsing a config file. This is expected to only be used for the
config file generator comparitor.

This means we finally don't generate warning messages on config
file parsing during our pep8 runs, and we do the right thing and
explode during tests if the config file doesn't exist in a real
way.

Change-Id: Ic4ae22814e2fdafc89a1997471283ccf8f3663bc
This commit is contained in:
Sean Dague 2013-12-22 11:30:06 -05:00
parent a9cf52e5f3
commit 2ec4c2c9f8
2 changed files with 5 additions and 7 deletions

View File

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

View File

@ -18,7 +18,6 @@
from __future__ import print_function
import os
import sys
from oslo.config import cfg
@ -654,7 +653,7 @@ class TempestConfigPrivate(object):
DEFAULT_CONFIG_FILE = "tempest.conf"
def __init__(self):
def __init__(self, parse_conf=True):
"""Initialize a configuration from a conf directory and conf file."""
super(TempestConfigPrivate, self).__init__()
config_files = []
@ -672,10 +671,9 @@ class TempestConfigPrivate(object):
'TEMPEST_CONFIG' in os.environ):
path = failsafe_path
if not os.path.exists(path):
msg = "Config file %s not found" % path
print(RuntimeError(msg), file=sys.stderr)
else:
# only parse the config file if we expect one to exist. This is needed
# to remove an issue with the config file up to date checker.
if parse_conf:
config_files.append(path)
cfg.CONF([], project='tempest', default_config_files=config_files)