]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cve-update-nvd2-native: log a little more
authorRoss Burton <ross.burton@arm.com>
Tue, 11 Jul 2023 11:26:35 +0000 (12:26 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 13 Jul 2023 06:55:16 +0000 (07:55 +0100)
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.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/meta/cve-update-nvd2-native.bb

index 8e5b83d7f166a25b455a3c30a163e7110bdfbae4..8a48e3ddc39ad8224d3f118830c8377a769966f0 100644 (file)
@@ -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"