From 1a6fa63ac96fc0d492c7dffa73011d1397ee165d Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Fri, 28 Apr 2023 16:12:04 +0200 Subject: [PATCH] Fix a traceback when failed to unlock a keyring --- osc/babysitter.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osc/babysitter.py b/osc/babysitter.py index 8b2085ea..f33a899d 100644 --- a/osc/babysitter.py +++ b/osc/babysitter.py @@ -36,6 +36,14 @@ except: pass +try: + from keyring.errors import KeyringLocked +except ImportError: + # python-keyring is not installed + class KeyringLocked: + pass + + # the good things are stolen from Matt Mackall's mercurial @@ -178,6 +186,8 @@ def run(prg, argv=None): print(f'{e.fname}:', e.msg, file=sys.stderr) except RPMError as e: print(e, file=sys.stderr) + except KeyringLocked as e: + print(e, file=sys.stderr) except CertVerificationError as e: print(e, file=sys.stderr) except urllib3.exceptions.MaxRetryError as e: