From 7ab8ee2118e27a7940f4b66d88f028b30c2fb513 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 15 Sep 2015 09:46:05 -0700 Subject: [PATCH] Remove duplicated API server The server in neutron.cmd.eventlet.api was almost exactly the same as neutron.cmd.eventlet.server.main_wsgi_pecan(). This patch just gets rid of the former and updates a bash script to reference the latter. Change-Id: Ib1ae1d4de9f61bf9eea7e3ceb7fd971195e452e3 --- neutron/cmd/eventlet/api.py | 68 ------------------------------------- tools/pecan_server.sh | 2 +- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 neutron/cmd/eventlet/api.py diff --git a/neutron/cmd/eventlet/api.py b/neutron/cmd/eventlet/api.py deleted file mode 100644 index 00a055041f1..00000000000 --- a/neutron/cmd/eventlet/api.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2013 Hewlett-Packard Development Company, L.P. -# Copyright 2014 Yahoo Inc -# All Rights Reserved. -# -# 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. - -# Much of this module is based on the work of the Ironic team -# see http://git.openstack.org/cgit/openstack/ironic/tree/ironic/cmd/api.py - -import logging as std_logging -import sys -from wsgiref import simple_server - -from oslo_config import cfg -from oslo_log import log as logging -from six.moves import socketserver - -from neutron.common import config -from neutron.pecan_wsgi import app -from neutron.i18n import _LI, _LW - - -CONF = cfg.CONF -LOG = logging.getLogger(__name__) - - -class ThreadedSimpleServer(socketserver.ThreadingMixIn, - simple_server.WSGIServer): - """A Mixin class to make the API service greenthread-able.""" - pass - - -def main(): - config.init(sys.argv[1:]) - config.setup_logging() - application = app.setup_app() - - host = CONF.bind_host - port = CONF.bind_port - - wsgi = simple_server.make_server( - host, - port, - application, - server_class=ThreadedSimpleServer - ) - - LOG.warning( - _LW("Stand-alone Server Serving on http://%(host)s:%(port)s"), - {'host': host, 'port': port} - ) - LOG.info(_LI("Configuration:")) - CONF.log_opt_values(LOG, std_logging.INFO) - - try: - wsgi.serve_forever() - except KeyboardInterrupt: - pass diff --git a/tools/pecan_server.sh b/tools/pecan_server.sh index ef4709aae9a..ef369198064 100755 --- a/tools/pecan_server.sh +++ b/tools/pecan_server.sh @@ -27,7 +27,7 @@ fi DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../ source "$DIR/.tox/py27/bin/activate" -COMMAND="python -c 'from neutron.cmd.eventlet import api; api.main()'" +COMMAND="python -c 'from neutron.cmd.eventlet import server; server.main_wsgi_pecan()'" function cleanup() { kill $PID