Skip to content

Commit cc8dd7f

Browse files
authored
Merge pull request #57 from stackhpc/upstream/2024.1-2025-07-14
Synchronise 2024.1 with upstream
2 parents e2cbba9 + 041b079 commit cc8dd7f

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

bin/octavia-wsgi

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python3
2+
#PBR Generated from 'wsgi_scripts' - Archived for Octavia stable branches
3+
4+
import threading
5+
6+
from octavia.api.app import setup_app
7+
8+
if __name__ == "__main__":
9+
import argparse
10+
import socket
11+
import sys
12+
import wsgiref.simple_server as wss
13+
14+
parser = argparse.ArgumentParser(
15+
description=setup_app.__doc__,
16+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
17+
usage='%(prog)s [-h] [--port PORT] [--host IP] -- [passed options]')
18+
parser.add_argument('--port', '-p', type=int, default=8000,
19+
help='TCP port to listen on')
20+
parser.add_argument('--host', '-b', default='',
21+
help='IP to bind the server to')
22+
parser.add_argument('args',
23+
nargs=argparse.REMAINDER,
24+
metavar='-- [passed options]',
25+
help="'--' is the separator of the arguments used "
26+
"to start the WSGI server and the arguments passed "
27+
"to the WSGI application.")
28+
args = parser.parse_args()
29+
if args.args:
30+
if args.args[0] == '--':
31+
args.args.pop(0)
32+
else:
33+
parser.error("unrecognized arguments: %s" % ' '.join(args.args))
34+
sys.argv[1:] = args.args
35+
server = wss.make_server(args.host, args.port, setup_app())
36+
37+
print("*" * 80)
38+
print("STARTING test server octavia.api.app.setup_app")
39+
url = "http://%s:%d/" % (server.server_name, server.server_port)
40+
print("Available at %s" % url)
41+
print("DANGER! For testing only, do not use in production")
42+
print("*" * 80)
43+
sys.stdout.flush()
44+
45+
server.serve_forever()
46+
else:
47+
application = None
48+
app_lock = threading.Lock()
49+
50+
with app_lock:
51+
if application is None:
52+
application = setup_app()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
other:
3+
- |
4+
Added a "octavia-wsgi" script for backward compatibility now that pbr's
5+
wsgi_scripts no longer functions with the latest setuptools.

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ data_files =
3737
diskimage-create/test-requirements.txt
3838
diskimage-create/tox.ini
3939
diskimage-create/version.txt
40+
scripts =
41+
bin/octavia-wsgi
4042

4143
[entry_points]
4244
wsgi_scripts =

0 commit comments

Comments
 (0)