diff options
author | Thomas Herve <therve@redhat.com> | 2016-03-22 22:06:46 +0100 |
---|---|---|
committer | Thomas Herve <therve@redhat.com> | 2016-04-14 17:11:15 +0200 |
commit | 8778c64776b092065988d92865ebaf2892930493 (patch) | |
tree | 5c218669f2fb60f20f9867330790983779f46b31 /pbr/packaging.py | |
parent | 6aa11493983739a88ab9de7af7cbbe68fde8dd03 (diff) | |
download | pbr-8778c64776b092065988d92865ebaf2892930493.tar.gz |
Fix wsgiref script use with oslo.config
The script generated for wsgi-script entrypoint adds a argument for
listening on a specific port using argparse. Unfortunately it's not
compatible with oslo.config handling of config options, as used by
keystone for example. This fixes the situation by only parsing known
options.
Change-Id: I37f82e8d78a4288323854282da300c123561218a
Closes-Bug: #1501756
Diffstat (limited to 'pbr/packaging.py')
-rw-r--r-- | pbr/packaging.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py index b42afab..fd9ffbe 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -265,10 +265,23 @@ if __name__ == "__main__": my_ip = socket.gethostbyname(socket.gethostname()) parser = argparse.ArgumentParser( description=%(import_target)s.__doc__, - formatter_class=argparse.ArgumentDefaultsHelpFormatter) + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + usage='%%(prog)s [-h] [--port PORT] -- [passed options]') parser.add_argument('--port', '-p', type=int, default=8000, help='TCP port to listen on') + 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 server = wss.make_server('', args.port, %(invoke_target)s()) print("*" * 80) |