diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2023-03-20 14:41:23 +0100 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2023-03-27 10:25:24 +0200 |
commit | 44872491d481780367ce3f3436bafbddae4c1537 (patch) | |
tree | 3279c7332a8f8acfba116538b367aaa57fbe0085 /bin | |
parent | 84507f829ab84f5175729e8e2ff7774a81b953bb (diff) |
update-vuln: _add_annotation_to_cve: use a bug variable
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/update-vuln | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/update-vuln b/bin/update-vuln index f6f93f2e46..d40a399758 100755 --- a/bin/update-vuln +++ b/bin/update-vuln @@ -96,12 +96,14 @@ class ParseUpdates: Accounts for PackageAnnotation.release == None for unstable. """ + bug = self.bugs[cve] + if isinstance(annotation, PackageAnnotation): - store = {ann.release: ann for ann in self.bugs[cve].annotations if isinstance(ann, PackageAnnotation)} + store = {ann.release: ann for ann in bug.annotations if isinstance(ann, PackageAnnotation)} store[annotation.release] = annotation # this is needed despite python3 >= 3.7 having ordered dicts # because using the dict.keys() would need a copy of that list anyway. - existing = [ann.release for ann in self.bugs[cve].annotations if isinstance(ann, PackageAnnotation)] + existing = [ann.release for ann in bug.annotations if isinstance(ann, PackageAnnotation)] if None in existing: # release == None for unstable index = existing.index(None) @@ -120,12 +122,12 @@ class ParseUpdates: bug_list.append(store[item]) elif isinstance(annotation, StringAnnotation): - bug_list = list(self.bugs[cve].annotations) + bug_list = list(bug.annotations) bug_list.append(annotation) else: raise ValueError(f"Unsupported annotation type: {type(annotation)}") - return Bug(self.bugs[cve].file, self.bugs[cve].header, tuple(bug_list)) + return Bug(bug.file, bug.header, tuple(bug_list)) def _replace_annotation_on_line(self, cve, line, mod_line): index = self.bugs[cve].annotations.index(line) |