[bug] catch request exceptions
authorRuben Pollan <meskio@sindominio.net>
Tue, 22 Sep 2015 14:18:36 +0000 (16:18 +0200)
committerRuben Pollan <meskio@sindominio.net>
Tue, 22 Sep 2015 15:42:13 +0000 (17:42 +0200)
On fetch_key we were not catching the request exceptions, now they are
returned as failure in the deferred as it should.

- Related: #7410

changes/bug-7410_fetch_key [new file with mode: 0644]
src/leap/keymanager/__init__.py

diff --git a/changes/bug-7410_fetch_key b/changes/bug-7410_fetch_key
new file mode 100644 (file)
index 0000000..4aec9fe
--- /dev/null
@@ -0,0 +1 @@
+- catch request exceptions on key fetching
index 5248cb0..e378c91 100644 (file)
@@ -820,7 +820,11 @@ class KeyManager(object):
         self._assert_supported_key_type(ktype)
 
         logger.info("Fetch key for %s from %s" % (address, uri))
-        res = self._get_with_combined_ca_bundle(uri)
+        try:
+            res = self._get_with_combined_ca_bundle(uri)
+        except Exception as e:
+            logger.warning("There was a problem fetching key: %s" % (e,))
+            return defer.fail(KeyNotFound(uri))
         if not res.ok:
             return defer.fail(KeyNotFound(uri))