From e315282bc55025c199483fbb5c94d7a053d047f0 Mon Sep 17 00:00:00 2001 From: Patrik Lundin Date: Mon, 17 Jun 2024 12:40:12 +0200 Subject: [PATCH] Use more strict exception checking This is probably wide enough and we do not need weird extra handling of our own execption etc. Thanks to @mickenordin for keeping me honest :). --- global/overlay/usr/local/bin/sunet-fleetlock | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/global/overlay/usr/local/bin/sunet-fleetlock b/global/overlay/usr/local/bin/sunet-fleetlock index 5c4e887..6f0b557 100755 --- a/global/overlay/usr/local/bin/sunet-fleetlock +++ b/global/overlay/usr/local/bin/sunet-fleetlock @@ -97,10 +97,7 @@ def do_fleetlock_request( timeout=args.request_timeout, auth=("", config[args.lock_group]["password"]), ) - except Exception as e: # pylint: disable=broad-exception-caught - if isinstance(e, TimeoutException): - # This means our global timer is up, no more time to retry - raise e + except requests.exceptions.ConnectionError as e: print(f"POST request failed: {e}") time.sleep(retry_sleep_delay) continue