diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-05-11 17:58:08 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-05-11 17:58:08 -0400 |
commit | 3f036f9155c3b3098de269afed4ab438989943d4 (patch) | |
tree | a8d14484fc7491cdba38fac112862f5faea2f47c | |
parent | 0c490dfee3604816dcceb628d2b7b263a744f7a9 (diff) | |
download | b4-3f036f9155c3b3098de269afed4ab438989943d4.tar.gz |
Fix crash when PGP key not in default keyring
Catch KeyError instead of backtracing.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/mbox.py | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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) |