Merge "Restoring the ability to run fake mode locally."

This commit is contained in:
Jenkins 2013-03-11 16:50:27 +00:00 committed by Gerrit Code Review
commit 21e3f0b288
4 changed files with 57 additions and 3 deletions

View File

@ -47,6 +47,8 @@ extra_opts = [
dest='fork'), dest='fork'),
openstack_cfg.StrOpt('pid-file', openstack_cfg.StrOpt('pid-file',
default='.pid'), default='.pid'),
openstack_cfg.StrOpt('override-logfile',
default=None),
] ]
CONF = cfg.CONF CONF = cfg.CONF
@ -56,8 +58,11 @@ CONF.register_cli_opts(extra_opts)
def run_server(): def run_server():
try: try:
get_db_api().configure_db(CONF) get_db_api().configure_db(CONF)
server = wsgi.WSGIService('reddwarf', CONF.bind_port or 8779) conf_file = CONF.find_file(CONF.api_paste_config)
launcher = service.launch(server) launcher = wsgi.launch('reddwarf', CONF.bind_port or 8779, conf_file)
launcher.wait() launcher.wait()
except RuntimeError as error: except RuntimeError as error:
import traceback import traceback
@ -67,6 +72,10 @@ def run_server():
if __name__ == '__main__': if __name__ == '__main__':
cfg.parse_args(sys.argv) cfg.parse_args(sys.argv)
if CONF.override_logfile:
CONF.use_stderr = False
CONF.log_file = CONF.override_logfile
logging.setup(None) logging.setup(None)
if CONF.fork: if CONF.fork:

View File

@ -14,5 +14,5 @@ run bin/reddwarf-manage \
reddwarf_test.sqlite mysql fake reddwarf_test.sqlite mysql fake
run bin/reddwarf-server \ run bin/reddwarf-server \
--fork --config-file=etc/reddwarf/reddwarf.conf.test \ --fork --config-file=etc/reddwarf/reddwarf.conf.test \
repo_path=reddwarf_test.sqlite $@ $@

View File

@ -0,0 +1,42 @@
[composite:reddwarf]
use = call:reddwarf.common.wsgi:versioned_urlmap
/: versions
/v1.0: reddwarfapi
[app:versions]
paste.app_factory = reddwarf.versions:app_factory
[pipeline:reddwarfapi]
pipeline = faultwrapper tokenauth authorization contextwrapper extensions reddwarfapp
#pipeline = debug extensions reddwarfapp
[filter:extensions]
paste.filter_factory = reddwarf.common.extensions:factory
[filter:tokenauth]
paste.filter_factory = reddwarf.tests.fakes.keystone:filter_factory
service_protocol = http
service_host = 127.0.0.1
service_port = 5000
auth_host = 127.0.0.1
auth_port = 35357
auth_protocol = http
auth_uri = http://127.0.0.1:5000/
admin_token = be19c524ddc92109a224
signing_dir = /tmp/keystone-signing-reddwarf
[filter:authorization]
paste.filter_factory = reddwarf.common.auth:AuthorizationMiddleware.factory
[filter:contextwrapper]
paste.filter_factory = reddwarf.common.wsgi:ContextMiddleware.factory
[filter:faultwrapper]
paste.filter_factory = reddwarf.common.wsgi:FaultWrapper.factory
[app:reddwarfapp]
paste.app_factory = reddwarf.common.api:app_factory
#Add this filter to log request and response for debugging
[filter:debug]
paste.filter_factory = reddwarf.common.wsgi:Debug

View File

@ -97,6 +97,8 @@ notifier_queue_port = 5672
notifier_queue_virtual_host = / notifier_queue_virtual_host = /
notifier_queue_transport = memory notifier_queue_transport = memory
api_paste_config=api-paste.ini.test
[composite:reddwarf] [composite:reddwarf]
use = call:reddwarf.common.wsgi:versioned_urlmap use = call:reddwarf.common.wsgi:versioned_urlmap
/: versions /: versions
@ -141,3 +143,4 @@ paste.app_factory = reddwarf.common.api:app_factory
#Add this filter to log request and response for debugging #Add this filter to log request and response for debugging
[filter:debug] [filter:debug]
paste.filter_factory = reddwarf.common.wsgi:Debug paste.filter_factory = reddwarf.common.wsgi:Debug