aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-11 17:58:08 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-11 17:58:08 -0400
commit3f036f9155c3b3098de269afed4ab438989943d4 (patch)
treea8d14484fc7491cdba38fac112862f5faea2f47c
parent0c490dfee3604816dcceb628d2b7b263a744f7a9 (diff)
downloadb4-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.py14
1 files changed, 7 insertions, 7 deletions
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)