Code refactor for prepare_service

Put the common codes used by api and conductor into a function.

Closes-Bug: 1472961
Change-Id: I3f7d431d9a91d9979d940d794db5bc383a077826
This commit is contained in:
Wanghua 2015-07-09 13:57:32 +08:00 committed by Hua Wang
parent 93ca5d37b4
commit af35cb173d
3 changed files with 3 additions and 4 deletions

View File

@ -31,7 +31,6 @@ LOG = logging.getLogger(__name__)
def main(): def main():
logging.register_options(cfg.CONF)
service.prepare_service(sys.argv) service.prepare_service(sys.argv)
app = api_app.setup_app() app = api_app.setup_app()

View File

@ -23,6 +23,7 @@ from oslo_log import log as logging
from oslo_service import service from oslo_service import service
from magnum.common import rpc_service from magnum.common import rpc_service
from magnum.common import service as magnum_service
from magnum.common import short_id from magnum.common import short_id
from magnum.conductor.handlers import bay_conductor from magnum.conductor.handlers import bay_conductor
from magnum.conductor.handlers import conductor_listener from magnum.conductor.handlers import conductor_listener
@ -35,9 +36,7 @@ LOG = logging.getLogger(__name__)
def main(): def main():
logging.register_options(cfg.CONF) magnum_service.prepare_service(sys.argv)
cfg.CONF(sys.argv[1:], project='magnum')
logging.setup(cfg.CONF, 'magnum')
LOG.info(_LI('Starting server in PID %s') % os.getpid()) LOG.info(_LI('Starting server in PID %s') % os.getpid())
LOG.debug("Configuration:") LOG.debug("Configuration:")

View File

@ -17,5 +17,6 @@ from oslo_log import log as logging
def prepare_service(argv=[]): def prepare_service(argv=[]):
logging.register_options(cfg.CONF)
cfg.CONF(argv[1:], project='magnum') cfg.CONF(argv[1:], project='magnum')
logging.setup(cfg.CONF, 'magnum') logging.setup(cfg.CONF, 'magnum')