From 3b5b6b92a89156fcb0a084099ed22abd1659ba0f Mon Sep 17 00:00:00 2001 From: Eric K Date: Thu, 31 Jan 2019 15:00:28 -0800 Subject: [PATCH] move config init from congress_servers.py to bin/congress-server The need to execute config init before importing harness in congress_servers.py causes a style violation in hacking 1.1.0. Here we move the initialization in bin/congress-server because it's the first place that sees the command line options. It also allows the work on upping hacking to 1.1.0 to go ahead. Change-Id: I7fbc12195f5d79d7df8da3bb835f3f89c1244efc --- bin/congress-server | 4 +++- congress/server/congress_server.py | 13 +++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/bin/congress-server b/bin/congress-server index fd292ae6b..e3b33001b 100755 --- a/bin/congress-server +++ b/bin/congress-server @@ -15,7 +15,6 @@ # under the License. # - import os import sys @@ -29,6 +28,9 @@ if os.path.exists(os.path.join(possible_topdir, '__init__.py')): sys.path.insert(0, possible_topdir) +# set command line config options +from congress.common import config +config.init(sys.argv[1:]) from congress.server import congress_server diff --git a/congress/server/congress_server.py b/congress/server/congress_server.py index 765c43722..5dccfc808 100644 --- a/congress/server/congress_server.py +++ b/congress/server/congress_server.py @@ -26,16 +26,8 @@ from oslo_log import log as logging from oslo_service import service from congress.common import config -from congress.db import api as db_api -# FIXME It has to initialize distributed_architecture flag basing on the -# config file before the python interpreter imports python file which has -# if-statement for deepsix. Since the default value of the flag is False -# in current implementation, so it will import dse.deepsix as deepsix -# even if you set it to True in congress.conf. -# After changing the default to True, remove following one line. -# This appears in main() too. Removing either instance breaks something. -config.init(sys.argv[1:]) from congress.common import eventlet_server +from congress.db import api as db_api from congress import encryption from congress import harness @@ -136,7 +128,8 @@ def main(): # TODO(thinrichs): find the right way to do deployment configuration. # For some reason we need to config.init(args) in 2 places; here and - # at the top of the file. Remove either one, and things break. + # at the top of the file (now moved to bin/congress-server). + # Remove either one, and things break. # Note: config.init() will delete the deploy args, so grab them before. config.init(args) if not cfg.CONF.config_file: