From f94e3aff14295821d28be0dbf3f4b40df980271c Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Tue, 22 Sep 2015 16:18:36 +0200 Subject: [bug] catch request exceptions On fetch_key we were not catching the request exceptions, now they are returned as failure in the deferred as it should. - Related: #7410 --- keymanager/changes/bug-7410_fetch_key | 1 + keymanager/src/leap/keymanager/__init__.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 keymanager/changes/bug-7410_fetch_key (limited to 'keymanager') diff --git a/keymanager/changes/bug-7410_fetch_key b/keymanager/changes/bug-7410_fetch_key new file mode 100644 index 0000000..4aec9fe --- /dev/null +++ b/keymanager/changes/bug-7410_fetch_key @@ -0,0 +1 @@ +- catch request exceptions on key fetching diff --git a/keymanager/src/leap/keymanager/__init__.py b/keymanager/src/leap/keymanager/__init__.py index 5248cb0..e378c91 100644 --- a/keymanager/src/leap/keymanager/__init__.py +++ b/keymanager/src/leap/keymanager/__init__.py @@ -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)) -- cgit v1.2.3