Package: toil / 5.9.2-2+deb12u1

ec2_error.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
commit 9524076964fa3ccb63dc54f83a9dd9d51984eb5c
Author: Michael R. Crusoe <michael.crusoe@gmail.com>
Date:   Mon Feb 6 19:00:08 2023 +0100
Forwarded: https://github.com/DataBiosphere/toil/pull/4371

    AWS: better handle errors getting EC2 identity.

diff --git a/src/toil/lib/aws/__init__.py b/src/toil/lib/aws/__init__.py
index 03c45848..3b1d493d 100644
--- a/src/toil/lib/aws/__init__.py
+++ b/src/toil/lib/aws/__init__.py
@@ -31,6 +31,7 @@ from typing import (Any,
                     Union)
 from urllib.error import URLError
 from urllib.request import urlopen
+from http.client import HTTPException
 
 logger = logging.getLogger(__name__)
 
@@ -164,7 +165,7 @@ def running_on_ec2() -> bool:
     try:
         urlopen('http://169.254.169.254/latest/dynamic/instance-identity/document', timeout=1)
         return True
-    except (URLError, socket.timeout):
+    except (URLError, socket.timeout, HTTPException):
         return False
 
 def running_on_ecs() -> bool: