From 579797adaba3f3b57d662e6b71280af458940cb3 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 11 Jul 2023 12:26:35 +0100 Subject: cve-update-nvd2-native: log a little more Add a note of what range we're fetching, and use bb.note() instead of debug() as messages about retrying shouldn't really be considered debug logging. (From OE-Core rev: f6c3ee35ae9950aec4b3dc15062b1c1fb5610011) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (cherry picked from commit b64a869b9c5e1d504f1011da16b5c5ff721afbf0) Signed-off-by: Steve Sakoman --- meta/recipes-core/meta/cve-update-nvd2-native.bb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'meta/recipes-core') diff --git a/meta/recipes-core/meta/cve-update-nvd2-native.bb b/meta/recipes-core/meta/cve-update-nvd2-native.bb index 8e5b83d7f1..8a48e3ddc3 100644 --- a/meta/recipes-core/meta/cve-update-nvd2-native.bb +++ b/meta/recipes-core/meta/cve-update-nvd2-native.bb @@ -125,6 +125,8 @@ def nvd_request_next(url, api_key, args): if api_key: headers['apiKey'] = api_key + bb.note("Requesting %s" % str(args)) + data = urllib.parse.urlencode(args) full_request = url + '?' + data @@ -142,7 +144,7 @@ def nvd_request_next(url, api_key, args): r.close() except Exception as e: - bb.debug(2, "CVE database: received error (%s), retrying (request: %s)" %(e, full_request)) + bb.note("CVE database: received error (%s), retrying (request: %s)" % (e, full_request)) time.sleep(6) pass else: @@ -173,7 +175,7 @@ def update_db_file(db_tmp_file, d, database_time): today_date = datetime.datetime.now(tz=datetime.timezone.utc) delta = today_date - database_date if delta.days < 120: - bb.debug(2, "CVE database: performing partial update") + bb.note("CVE database: performing partial update") req_args['lastModStartDate'] = database_date.isoformat() req_args['lastModEndDate'] = today_date.isoformat() else: @@ -181,7 +183,7 @@ def update_db_file(db_tmp_file, d, database_time): with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: - bb.debug(2, "Updating entries") + bb.note("Updating entries") index = 0 url = d.getVar("NVDCVE_URL") while True: @@ -196,7 +198,7 @@ def update_db_file(db_tmp_file, d, database_time): index = data["startIndex"] total = data["totalResults"] per_page = data["resultsPerPage"] - + bb.note("Got %d entries" % per_page) for cve in data["vulnerabilities"]: update_db(conn, cve) @@ -332,7 +334,7 @@ def update_db(conn, elt): for node in config["nodes"]: parse_node_and_insert(conn, node, cveId) except KeyError: - bb.debug(2, "CVE %s has no configurations" % cveId) + bb.note("CVE %s has no configurations" % cveId) do_fetch[nostamp] = "1" -- cgit v1.2.3-54-g00ecf