From ca6e310de0cb490eb33e0ce70e7306f9ff6e3ebf Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 18 Nov 2024 16:37:00 +0100 Subject: [PATCH] Prevent stacktrace during SIGTERM signal and open_device call Signed-off-by: Ronan Abhamon --- http_disk_server.py | 4 ++++ setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/http_disk_server.py b/http_disk_server.py index de51eed..e17b2e5 100755 --- a/http_disk_server.py +++ b/http_disk_server.py @@ -425,6 +425,10 @@ def emit_server_ready(): disk_fd = open_device(disk, retry=False) else: disk_fd = open_device(disk) + + if SIGTERM_RECEIVED: + break + is_block_device = stat.S_ISBLK(os.fstat(disk_fd).st_mode) HandlerClass = MakeRequestHandler(disk_fd, is_block_device) diff --git a/setup.py b/setup.py index 68bf933..d7286b2 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup( name="http-nbd-transfer", - version="1.4.0", + version="1.5.0", description="Set of tools to transfer NBD requests to an HTTP server", author="Ronan Abhamon ", author_email="ronan.abhamon@vates.tech",