mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 03:49:32 +02:00
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: be409f17e64dac2c6fa2cafba73c2084c68c59bf) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit b64a869b9c5e1d504f1011da16b5c5ff721afbf0) Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
c5558d6e86
commit
8a14072295
@@ -125,6 +125,8 @@ def nvd_request_next(url, api_key, args):
|
|||||||
if api_key:
|
if api_key:
|
||||||
headers['apiKey'] = api_key
|
headers['apiKey'] = api_key
|
||||||
|
|
||||||
|
bb.note("Requesting %s" % str(args))
|
||||||
|
|
||||||
data = urllib.parse.urlencode(args)
|
data = urllib.parse.urlencode(args)
|
||||||
|
|
||||||
full_request = url + '?' + data
|
full_request = url + '?' + data
|
||||||
@@ -142,7 +144,7 @@ def nvd_request_next(url, api_key, args):
|
|||||||
r.close()
|
r.close()
|
||||||
|
|
||||||
except Exception as e:
|
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)
|
time.sleep(6)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -173,7 +175,7 @@ def update_db_file(db_tmp_file, d, database_time):
|
|||||||
today_date = datetime.datetime.now(tz=datetime.timezone.utc)
|
today_date = datetime.datetime.now(tz=datetime.timezone.utc)
|
||||||
delta = today_date - database_date
|
delta = today_date - database_date
|
||||||
if delta.days < 120:
|
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['lastModStartDate'] = database_date.isoformat()
|
||||||
req_args['lastModEndDate'] = today_date.isoformat()
|
req_args['lastModEndDate'] = today_date.isoformat()
|
||||||
else:
|
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:
|
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
|
index = 0
|
||||||
url = d.getVar("NVDCVE_URL")
|
url = d.getVar("NVDCVE_URL")
|
||||||
while True:
|
while True:
|
||||||
@@ -196,7 +198,7 @@ def update_db_file(db_tmp_file, d, database_time):
|
|||||||
index = data["startIndex"]
|
index = data["startIndex"]
|
||||||
total = data["totalResults"]
|
total = data["totalResults"]
|
||||||
per_page = data["resultsPerPage"]
|
per_page = data["resultsPerPage"]
|
||||||
|
bb.note("Got %d entries" % per_page)
|
||||||
for cve in data["vulnerabilities"]:
|
for cve in data["vulnerabilities"]:
|
||||||
update_db(conn, cve)
|
update_db(conn, cve)
|
||||||
|
|
||||||
@@ -332,7 +334,7 @@ def update_db(conn, elt):
|
|||||||
for node in config["nodes"]:
|
for node in config["nodes"]:
|
||||||
parse_node_and_insert(conn, node, cveId)
|
parse_node_and_insert(conn, node, cveId)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
bb.debug(2, "CVE %s has no configurations" % cveId)
|
bb.note("CVE %s has no configurations" % cveId)
|
||||||
|
|
||||||
do_fetch[nostamp] = "1"
|
do_fetch[nostamp] = "1"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user