summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-07-11 12:26:35 +0100
committerSteve Sakoman <steve@sakoman.com>2023-07-13 07:03:17 -1000
commit579797adaba3f3b57d662e6b71280af458940cb3 (patch)
treec6667ae0b9ce22dbe13788ab41faa193a2b4d24e /meta/recipes-core
parent9faca1f692d10afb796edcc7fb145e5d4130fe6a (diff)
downloadpoky-579797adaba3f3b57d662e6b71280af458940cb3.tar.gz
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 <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>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/meta/cve-update-nvd2-native.bb12
1 files changed, 7 insertions, 5 deletions
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):
125 if api_key: 125 if api_key:
126 headers['apiKey'] = api_key 126 headers['apiKey'] = api_key
127 127
128 bb.note("Requesting %s" % str(args))
129
128 data = urllib.parse.urlencode(args) 130 data = urllib.parse.urlencode(args)
129 131
130 full_request = url + '?' + data 132 full_request = url + '?' + data
@@ -142,7 +144,7 @@ def nvd_request_next(url, api_key, args):
142 r.close() 144 r.close()
143 145
144 except Exception as e: 146 except Exception as e:
145 bb.debug(2, "CVE database: received error (%s), retrying (request: %s)" %(e, full_request)) 147 bb.note("CVE database: received error (%s), retrying (request: %s)" % (e, full_request))
146 time.sleep(6) 148 time.sleep(6)
147 pass 149 pass
148 else: 150 else:
@@ -173,7 +175,7 @@ def update_db_file(db_tmp_file, d, database_time):
173 today_date = datetime.datetime.now(tz=datetime.timezone.utc) 175 today_date = datetime.datetime.now(tz=datetime.timezone.utc)
174 delta = today_date - database_date 176 delta = today_date - database_date
175 if delta.days < 120: 177 if delta.days < 120:
176 bb.debug(2, "CVE database: performing partial update") 178 bb.note("CVE database: performing partial update")
177 req_args['lastModStartDate'] = database_date.isoformat() 179 req_args['lastModStartDate'] = database_date.isoformat()
178 req_args['lastModEndDate'] = today_date.isoformat() 180 req_args['lastModEndDate'] = today_date.isoformat()
179 else: 181 else:
@@ -181,7 +183,7 @@ def update_db_file(db_tmp_file, d, database_time):
181 183
182 with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: 184 with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
183 185
184 bb.debug(2, "Updating entries") 186 bb.note("Updating entries")
185 index = 0 187 index = 0
186 url = d.getVar("NVDCVE_URL") 188 url = d.getVar("NVDCVE_URL")
187 while True: 189 while True:
@@ -196,7 +198,7 @@ def update_db_file(db_tmp_file, d, database_time):
196 index = data["startIndex"] 198 index = data["startIndex"]
197 total = data["totalResults"] 199 total = data["totalResults"]
198 per_page = data["resultsPerPage"] 200 per_page = data["resultsPerPage"]
199 201 bb.note("Got %d entries" % per_page)
200 for cve in data["vulnerabilities"]: 202 for cve in data["vulnerabilities"]:
201 update_db(conn, cve) 203 update_db(conn, cve)
202 204
@@ -332,7 +334,7 @@ def update_db(conn, elt):
332 for node in config["nodes"]: 334 for node in config["nodes"]:
333 parse_node_and_insert(conn, node, cveId) 335 parse_node_and_insert(conn, node, cveId)
334 except KeyError: 336 except KeyError:
335 bb.debug(2, "CVE %s has no configurations" % cveId) 337 bb.note("CVE %s has no configurations" % cveId)
336 338
337do_fetch[nostamp] = "1" 339do_fetch[nostamp] = "1"
338 340