From 3f036f9155c3b3098de269afed4ab438989943d4 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 11 May 2021 17:58:08 -0400 Subject: Fix crash when PGP key not in default keyring Catch KeyError instead of backtracing. Signed-off-by: Konstantin Ryabitsev --- b4/mbox.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'b4') diff --git a/b4/mbox.py b/b4/mbox.py index e418572..69429e0 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -580,14 +580,14 @@ def main(cmdargs): if os.path.exists(fullpath): status = 'known' else: + status = 'unknown' if algo == 'openpgp': - uids = b4.get_gpg_uids(keyinfo) - if len(uids): - status = 'in default keyring' - else: - status = 'unknown' - else: - status = 'unknown' + try: + uids = b4.get_gpg_uids(keyinfo) + if len(uids): + status = 'in default keyring' + except KeyError: + pass pathlib.Path(os.path.dirname(fullpath)).mkdir(parents=True, exist_ok=True) logger.info('%s: (%s)', identity, status) -- cgit v1.2.3