Fix pep8 issues

Apparently functional tests code caused oslo.config to try to parse cli
arguments. After that openstack/common/log.py tried to register cli opts,
but failed because cli opts can't be registered after cli args were parsed.

This patch moves config initialization to a separate method to prevent
cli args from being parsed on the load time

Change-Id: If40409b306a7aabdbd3cf467319a1574b440a690
This commit is contained in:
Ruslan Kamaldinov 2014-06-28 16:09:40 +04:00
parent eae00b9970
commit 414fb984c5
2 changed files with 9 additions and 6 deletions

View File

@ -117,6 +117,8 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
def setUpClass(cls): def setUpClass(cls):
super(MuranoBase, cls).setUpClass() super(MuranoBase, cls).setUpClass()
cfg.load_config()
cls.client = Client(user=CONF.murano.user, cls.client = Client(user=CONF.murano.user,
password=CONF.murano.password, password=CONF.murano.password,
tenant=CONF.murano.tenant, tenant=CONF.murano.tenant,

View File

@ -49,12 +49,13 @@ def register_config(config, config_group, config_opts):
config.register_group(config_group) config.register_group(config_group)
config.register_opts(config_opts, config_group) config.register_opts(config_opts, config_group)
__location = os.path.realpath(os.path.join(os.getcwd(),
os.path.dirname(__file__)))
path = os.path.join(__location, "config.conf") def load_config():
__location = os.path.realpath(os.path.join(os.getcwd(),
os.path.dirname(__file__)))
path = os.path.join(__location, "config.conf")
if os.path.exists(path): if os.path.exists(path):
cfg.CONF([], project='muranointegration', default_config_files=[path]) cfg.CONF([], project='muranointegration', default_config_files=[path])
register_config(cfg.CONF, murano_group, MuranoGroup) register_config(cfg.CONF, murano_group, MuranoGroup)