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: b64a869b9c5e1d504f1011da16b5c5ff721afbf0)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2023-07-11 12:26:35 +01:00
committed by Richard Purdie
parent 5fd239a233
commit d606ee181d

View 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"