From 7370b238226032bb378d8ed63a248c5d2d7bf7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Mon, 24 Feb 2020 11:26:49 +0100 Subject: [PATCH] osc can crash due to various exceptions when loading key management. Not sure if this is the best way, but make osc usable at all again... --- osc/credentials.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osc/credentials.py b/osc/credentials.py index d2ce493b..22425627 100644 --- a/osc/credentials.py +++ b/osc/credentials.py @@ -2,18 +2,32 @@ import importlib import bz2 import base64 import getpass +import sys + try: from urllib.parse import urlsplit except ImportError: from urlparse import urlsplit + try: import keyring except ImportError: keyring = None +except BaseException as e: + # catch and report any exceptions raised in the 'keyring' module + msg = "Warning: Unable to load the 'keyring' module due to an internal error:" + print(msg, e, file=sys.stderr) + keyring = None + try: import gnomekeyring except ImportError: gnomekeyring = None +except BaseException as e: + # catch and report any exceptions raised in the 'gnomekeyring' module + msg = "Warning: Unable to load the 'gnomekeyring' module due to an internal error:" + print(msg, e, file=sys.stderr) + gnomekeyring = None class AbstractCredentialsManagerDescriptor(object):