Merge pull request #1609 from coreos-inc/package-vuln-test-notify
Fix `get_priority_for_index` method for non-int values
This commit is contained in:
commit
da0357a460
1 changed files with 9 additions and 4 deletions
|
@ -97,8 +97,13 @@ PRIORITY_LEVELS = {
|
|||
|
||||
|
||||
def get_priority_for_index(index):
|
||||
for priority in PRIORITY_LEVELS:
|
||||
if PRIORITY_LEVELS[priority]['index'] == index:
|
||||
return priority
|
||||
try:
|
||||
int_index = int(index)
|
||||
except ValueError:
|
||||
return 'Unknown'
|
||||
|
||||
return 'Unknown'
|
||||
for priority in PRIORITY_LEVELS:
|
||||
if PRIORITY_LEVELS[priority]['index'] == int_index:
|
||||
return priority
|
||||
|
||||
return 'Unknown'
|
||||
|
|
Reference in a new issue