From 414fb984c508ba43b6d25de4b02a3912a6441fb1 Mon Sep 17 00:00:00 2001 From: Ruslan Kamaldinov Date: Sat, 28 Jun 2014 16:09:40 +0400 Subject: [PATCH] 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 --- functionaltests/engine/base.py | 2 ++ functionaltests/engine/config.py | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/functionaltests/engine/base.py b/functionaltests/engine/base.py index 18b3c0812..dd3bb6899 100644 --- a/functionaltests/engine/base.py +++ b/functionaltests/engine/base.py @@ -117,6 +117,8 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes, def setUpClass(cls): super(MuranoBase, cls).setUpClass() + cfg.load_config() + cls.client = Client(user=CONF.murano.user, password=CONF.murano.password, tenant=CONF.murano.tenant, diff --git a/functionaltests/engine/config.py b/functionaltests/engine/config.py index e6cd17966..975408a55 100644 --- a/functionaltests/engine/config.py +++ b/functionaltests/engine/config.py @@ -49,12 +49,13 @@ def register_config(config, config_group, config_opts): config.register_group(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): - cfg.CONF([], project='muranointegration', default_config_files=[path]) + if os.path.exists(path): + cfg.CONF([], project='muranointegration', default_config_files=[path]) -register_config(cfg.CONF, murano_group, MuranoGroup) + register_config(cfg.CONF, murano_group, MuranoGroup)