upstream/openstack/python-nova/centos/files/nova-placement-api
Sun Austin 0de76ec71d flake8 codestyle fixes and tox flake8 setting enable
Fix major below issues:
E741 ambiguous variable name 'l'
./openstack/python-horizon/centos/files/guni_config.py
E402 module level import not at top of file
./openstack/python-horizon/centos/files/local_settings.py
E265 block comment should start with '# '
./openstack/python-horizon/centos/files/local_settings.py

Story: 2003428
Task: 24617

Change-Id: I9d4d6c33ce032849f09e2ec232c83909fc6690a3
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-08-24 23:19:50 +08:00

64 lines
2.2 KiB
Python
Executable File

#!/usr/bin/python2
# PBR Generated from u'wsgi_scripts'
import threading
from nova.api.openstack.placement.wsgi import init_application
if __name__ == "__main__":
import argparse
import netaddr
import socket
import sys
import wsgiref.simple_server as wss
parser = argparse.ArgumentParser(
description=init_application.__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
usage='%(prog)s [-h] [--port PORT] [--host IP] -- [passed options]')
parser.add_argument('--port', '-p', type=int, default=8000,
help='TCP port to listen on')
parser.add_argument('--host', '-b', default='',
help='IP to bind the server to')
parser.add_argument('args',
nargs=argparse.REMAINDER,
metavar='-- [passed options]',
help="'--' is the separator of the arguments used "
"to start the WSGI server and the arguments passed "
"to the WSGI application.")
args = parser.parse_args()
if args.args:
if args.args[0] == '--':
args.args.pop(0)
else:
parser.error("unrecognized arguments: %s" % ' '.join(args.args))
sys.argv[1:] = args.args
# WRS: In order to support IPv6, server_class.address_family must be set
# to the correct address family. Determine this from specified address.
class server_class(wss.WSGIServer):
pass
if netaddr.valid_ipv4(args.host):
server_class.address_family = socket.AF_INET
else:
server_class.address_family = socket.AF_INET6
server = wss.make_server(args.host, args.port, init_application(),
server_class=server_class)
print("*" * 80)
print("STARTING test server nova.api.openstack.placement.wsgi.init_application")
url = "http://%s:%d/" % (server.server_name, server.server_port)
print("Available at %s" % url)
print("*" * 80)
sys.stdout.flush()
server.serve_forever()
else:
application = None
app_lock = threading.Lock()
with app_lock:
if application is None:
application = init_application()