From c4312498ebe0643061f1d06ad9655d49fb9d9af7 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 6 May 2020 17:43:33 -0500 Subject: http api: T2395: replace bottle with flask as microframework --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/control b/debian/control index 5c176f40a..592d5153d 100644 --- a/debian/control +++ b/debian/control @@ -28,7 +28,7 @@ Depends: python3, python3-isc-dhcp-leases, python3-hurry.filesize, python3-vici (>= 5.7.2), - python3-bottle, + python3-flask, python3-netaddr, python3-zmq, cron, -- cgit v1.2.3 From 7b31dd720d96bc481323e3b00100da718f551cd5 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 6 May 2020 17:49:12 -0500 Subject: http api: T2395: add waitress as production WSGI server --- debian/control | 1 + src/services/vyos-http-api-server | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/control b/debian/control index 592d5153d..32c0286a4 100644 --- a/debian/control +++ b/debian/control @@ -29,6 +29,7 @@ Depends: python3, python3-hurry.filesize, python3-vici (>= 5.7.2), python3-flask, + python3-waitress, python3-netaddr, python3-zmq, cron, diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server index 4a653bb66..4c41fa96d 100755 --- a/src/services/vyos-http-api-server +++ b/src/services/vyos-http-api-server @@ -27,6 +27,7 @@ import signal import vyos.config from flask import Flask, request +from waitress import serve from functools import wraps @@ -395,4 +396,8 @@ if __name__ == '__main__': signal.signal(signal.SIGTERM, sig_handler) - app.run(host=server_config["listen_address"], port=server_config["port"], debug=True) + try: + serve(app, host=server_config["listen_address"], + port=server_config["port"]) + except OSError as e: + print(f"OSError {e}") -- cgit v1.2.3