zaqar/marconi/cmd/server.py
kgriffs e6f42d55f8 fix(bootstrap): Logging CLI options don't work
In the current implementation, Bootstrap creates the config option
inside its initializer. That means that common options such as
those registered by openstack.common.log, are not registered.

This patch modifies the Bootstrap initializer to take a config
instance from the caller, rather than trying to build one
itself. This does two things for us:

1. Avoids "magic" marconi configuration; the caller has full
   control and visibility into how marconi is configured.
2. Allows for passing in the global CONF object from the
   marconi-server command and the reference WSGI app module
   so that common options registered by oslo modules on the
   global CONF instance are picked up.

Hopefully openstack.common.log will be modified at some point
so that it isn't tightly coupled with cfg.CONF.

Implements: blueprint remove-global-config
Change-Id: Ibb6638f99ca2ce4a2a6025f6cd41939bb30fa85a
2013-10-17 10:33:17 -05:00

32 lines
1.0 KiB
Python

# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.config import cfg
from marconi.common import cli
from marconi.queues import bootstrap
@cli.runnable
def run():
# TODO(kgriffs): For now, we have to use the global config
# to pick up common options from openstack.common.log, since
# that module uses the global CONF instance exclusively.
conf = cfg.CONF
conf(project='marconi', prog='marconi-queues')
server = bootstrap.Bootstrap(conf)
server.run()