Merge ~emitorino/ubuntu-cve-tracker:support_json_on_check_unreplaced_templates into ubuntu-cve-tracker:master

Proposed by Emilia Torino
Status: Merged
Merge reported by: Steve Beattie
Merged at revision: b1158456f2af4e9a19de2b3e4532bc4325ff72f1
Proposed branch: ~emitorino/ubuntu-cve-tracker:support_json_on_check_unreplaced_templates
Merge into: ubuntu-cve-tracker:master
Diff against target: 46 lines (+12/-7)
1 file modified
scripts/check-unreplaced-templates.py (+12/-7)
Reviewer Review Type Date Requested Status
Steve Beattie Approve
Review via email: mp+403158@code.launchpad.net

Commit message

- scripts/check-unreplaced-templates.py: add support to check json specified in stdin

Description of the change

This is needed as part of the USNs update effort, to update existing USNs with new required data

To post a comment you must log in.
b115845... by Emilia Torino

Support json on check_unreplaced_templates scripts

Signed-off-by: Maria Emilia Torino <email address hidden>

Revision history for this message
Steve Beattie (sbeattie) wrote :

LGTM, merging. Enjoy your long weekend!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/check-unreplaced-templates.py b/scripts/check-unreplaced-templates.py
2index 14a1e45..4723688 100755
3--- a/scripts/check-unreplaced-templates.py
4+++ b/scripts/check-unreplaced-templates.py
5@@ -13,6 +13,7 @@ from __future__ import print_function
6
7 import sys
8 import cve_lib
9+import json
10 import optparse
11 import usn_lib
12
13@@ -20,6 +21,7 @@ parser = optparse.OptionParser()
14 parser.add_option("-d", "--debug", help="Report additional debugging while loading USNs", action='store_true')
15 parser.add_option("-v", "--verbose", help="Show isummary and package descriptions for each reported USN", action='store_true')
16 parser.add_option("-u", "--update", help="Clear unfilled isummary template fields", action='store_true')
17+parser.add_option("-j", "--json", help="Check json instead of default pickle database", action='store_true')
18 (opt, args) = parser.parse_args()
19
20 cves = dict()
21@@ -27,15 +29,18 @@ cves = dict()
22 config = cve_lib.read_config()
23
24 changed = False
25-dbfile = None
26-if len(args) < 1:
27- dbfile = config['usn_db_copy']
28+if opt.json:
29+ db = json.load(sys.stdin)
30 else:
31- dbfile = args[0]
32+ dbfile = None
33+ if len(args) < 1:
34+ dbfile = config['usn_db_copy']
35+ else:
36+ dbfile = args[0]
37
38-if opt.debug:
39- print("Loading %s ..." % (dbfile), file=sys.stderr)
40-db = usn_lib.load_database(dbfile)
41+ if opt.debug:
42+ print("Loading %s ..." % (dbfile), file=sys.stderr)
43+ db = usn_lib.load_database(dbfile)
44
45 if len(args) < 2:
46 usns = sorted(db, key=lambda a: list(map(int, a.split('-'))))

Subscribers

People subscribed via source and target branches