From 9382dafc7a7448cd1ed808e810b97a6a9a73f68d Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Wed, 14 Feb 2018 15:18:42 +0100 Subject: [PATCH] Do not traceback on unknown severity value (RhBug:1545075) https://bugzilla.redhat.com/show_bug.cgi?id=1545075 Closes: #1028 Approved by: mhatina --- dnf/cli/commands/updateinfo.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dnf/cli/commands/updateinfo.py b/dnf/cli/commands/updateinfo.py index b74428e286..a9f0e4fab9 100644 --- a/dnf/cli/commands/updateinfo.py +++ b/dnf/cli/commands/updateinfo.py @@ -52,8 +52,7 @@ class UpdateInfoCommand(commands.Command): SECURITY2LABEL = {'Critical': _('Critical/Sec.'), 'Important': _('Important/Sec.'), 'Moderate': _('Moderate/Sec.'), - 'Low': _('Low/Sec.'), - None: _('Unknown/Sec.')} + 'Low': _('Low/Sec.')} direct_commands = {'list-updateinfo' : 'list', 'list-security' : 'list', @@ -280,8 +279,10 @@ def inst2mark(inst): return ('' if not mixed else 'i ' if inst else ' ') def type2label(typ, sev): - return (cls.SECURITY2LABEL[sev] if typ == hawkey.ADVISORY_SECURITY - else cls.TYPE2LABEL[typ]) + if typ == hawkey.ADVISORY_SECURITY: + return cls.SECURITY2LABEL.get(sev, _('Unknown/Sec.')) + else: + return cls.TYPE2LABEL.get(typ, _('unknown')) # Sort IDs and convert types to labels. nevramark2id2tlbl = OrderedDict(