[ARVADOS] created: 0b4ad564482929d3f8eaefe8324df54bb276b74b

git at public.curoverse.com git at public.curoverse.com
Tue Mar 3 17:00:13 EST 2015


        at  0b4ad564482929d3f8eaefe8324df54bb276b74b (commit)


commit 0b4ad564482929d3f8eaefe8324df54bb276b74b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Mar 3 17:03:49 2015 -0500

    5246: Add urllib3 workaround, along with a note why it is necessary.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 62c6709..cbc51aa 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -27,6 +27,28 @@ import arvados.errors
 import arvados.retry as retry
 import arvados.util
 
+try:
+    # Workaround for urllib3 bug.
+    # The 'requests' library enables urllib3's SNI support by default, which uses pyopenssl.
+    # However, urllib3 prior to version 1.10 has a major bug in this feature
+    # (OpenSSL WantWriteError, https://github.com/shazow/urllib3/issues/412)
+    # Unfortunately a certain major Linux distribution is stablizing on urllib3
+    # 1.9.1 which means the following workaround is necessary to be able to use
+    # the arvados python sdk with the distribution-provided packages.
+
+    import urllib3
+    urllib3_ok = False
+    urllib3version = re.match(r'(\d+)\.(\d+)\.(\d+)', urllib3.__version__)
+    if (urllib3version and
+        int(urllib3version.group(1)) == 1 and
+        int(urllib3version.group(2)) >= 10):
+        urllib3_ok = True
+    if not urllib3_ok:
+        from urllib3.contrib import pyopenssl
+        pyopenssl.extract_from_urllib3()
+except ImportError:
+    pass
+
 _logger = logging.getLogger('arvados.keep')
 global_client_object = None
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list