Relocates cli options registration from bootstrap to server
This fixes an issue (see rhbz#1333884) where using the tempest CLI results in the error 'Could not load 'zaqar_tests': arguments already parsed: cannot register CLI option'. Moving the cli options registration to cmd.server resolves this problem. Change-Id: I56779da783261c6eba07a7d9286d1615dcff3598
This commit is contained in:
parent
b8a70e4aec
commit
e439b2e9ce
@ -13,7 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from stevedore import driver
|
||||
|
||||
@ -33,19 +32,6 @@ from zaqar.i18n import _LE
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
_CLI_OPTIONS = (
|
||||
configs._ADMIN_MODE_OPT,
|
||||
cfg.BoolOpt('daemon', default=False,
|
||||
help='Run Zaqar server in the background.'),
|
||||
)
|
||||
|
||||
# NOTE (Obulpathi): Register daemon command line option for
|
||||
# zaqar-server
|
||||
CONF = cfg.CONF
|
||||
CONF.register_cli_opts(_CLI_OPTIONS)
|
||||
log.register_options(CONF)
|
||||
|
||||
|
||||
class Bootstrap(object):
|
||||
"""Defines the Zaqar bootstrapper.
|
||||
|
||||
@ -61,8 +47,6 @@ class Bootstrap(object):
|
||||
|
||||
self.driver_conf = self.conf[configs._DRIVER_GROUP]
|
||||
|
||||
log.setup(conf, 'zaqar')
|
||||
|
||||
@decorators.lazy_property(write=False)
|
||||
def api(self):
|
||||
LOG.debug(u'Loading API handler')
|
||||
|
@ -15,9 +15,18 @@
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from zaqar import bootstrap
|
||||
from zaqar.common import cli
|
||||
from zaqar.common import configs
|
||||
|
||||
# NOTE(eggmaster): define command line options for zaqar-server
|
||||
_CLI_OPTIONS = (
|
||||
configs._ADMIN_MODE_OPT,
|
||||
cfg.BoolOpt('daemon', default=False,
|
||||
help='Run Zaqar server in the background.'),
|
||||
)
|
||||
|
||||
|
||||
@cli.runnable
|
||||
@ -26,13 +35,18 @@ def run():
|
||||
# to pick up common options from openstack.common.log, since
|
||||
# that module uses the global CONF instance exclusively.
|
||||
conf = cfg.CONF
|
||||
conf(project='zaqar', prog='zaqar-server')
|
||||
# NOTE(eggmaster): register command line options for zaqar-server
|
||||
conf.register_cli_opts(_CLI_OPTIONS)
|
||||
log.register_options(conf)
|
||||
log.setup(conf, 'zaqar')
|
||||
|
||||
# NOTE(jeffrey4l): Overwrite the default vaule for
|
||||
# logging_context_format_string. Add project_id into it.
|
||||
conf.set_default('logging_context_format_string',
|
||||
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s'
|
||||
' %(name)s [%(request_id)s %(user_identity)s]'
|
||||
' [project_id:%(project_id)s] %(message)s')
|
||||
conf(project='zaqar', prog='zaqar-queues')
|
||||
|
||||
server = bootstrap.Bootstrap(conf)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user