Implemented marconi-server entry point
This patch adds the first console_script for marconi server. In order to use it it's enough to run setup.py either using develop or install. Side changes: The config now uses sys.argv[1:] if no custom cli args have been set. Implements blueprint transport-base Change-Id: I15732129d66b32fca2b818e9105b17f541094983
This commit is contained in:
parent
7e02abc5db
commit
7563c63c90
@ -11,4 +11,5 @@ port = 8888
|
||||
;port = 9999
|
||||
|
||||
[drivers:storage:mongodb]
|
||||
uri = mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test&ssl=true&w=majority
|
||||
uri = mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test&ssl=true&w=majority
|
||||
database = marconi
|
||||
|
0
marconi/bin/__init__.py
Normal file
0
marconi/bin/__init__.py
Normal file
33
marconi/bin/server.py
Normal file
33
marconi/bin/server.py
Normal file
@ -0,0 +1,33 @@
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
|
||||
from marconi import bootstrap
|
||||
|
||||
|
||||
def fail(returncode, e):
|
||||
sys.stderr.write("ERROR: %s\n" % e)
|
||||
sys.exit(returncode)
|
||||
|
||||
|
||||
def run():
|
||||
try:
|
||||
server = bootstrap.Bootstrap()
|
||||
server.run()
|
||||
except KeyboardInterrupt:
|
||||
fail(1, '... terminating marconi')
|
||||
except RuntimeError as e:
|
||||
fail(1, e)
|
@ -52,12 +52,15 @@ A call to `.load` without an argument looks up for the default ones:
|
||||
~/.marconi/marconi.conf
|
||||
/etc/marconi/marconi.conf
|
||||
|
||||
The global config variables, if any, can also be read from the command
|
||||
line arguments by saving them before a `.load` call:
|
||||
Global config variables, if any, will be read from the command line using
|
||||
sys.argv[:1]. If needed, this can be overwritten by calling `set_cli`
|
||||
before calling `.load`
|
||||
|
||||
cfg_handle.set_cli(sys.argv[1:])
|
||||
cfg_handle.set_cli([])
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
||||
@ -73,7 +76,7 @@ def _init():
|
||||
__setattr__ = dict.__setitem__
|
||||
|
||||
conf = cfg.ConfigOpts()
|
||||
my = Obj(args=[])
|
||||
my = Obj(args=sys.argv[1:])
|
||||
|
||||
def namespace(name, title=None):
|
||||
"""
|
||||
|
@ -51,6 +51,8 @@ class TestBase(testtools.TestCase):
|
||||
|
||||
:returns: Project's config object.
|
||||
"""
|
||||
# Reset CLI
|
||||
cfg.set_cli([])
|
||||
cfg.load(self.conf_path(filename))
|
||||
return cfg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user