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
This commit is contained in:
Eric K 2019-01-31 15:00:28 -08:00
parent e5d979a3c7
commit 3b5b6b92a8
2 changed files with 6 additions and 11 deletions

View File

@ -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

View File

@ -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: