cve-update-db-native: prevent fatal error cause by network

prevent cve-check from fatal error cause by network issue.

[YOCTO #13680]

(From OE-Core rev: da358e415726f836e6b3e69ad7fbeffb50bd402d)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Lee Chee Yang
2020-03-25 19:29:54 +08:00
committed by Richard Purdie
parent 1bf1e1539f
commit 117a6dac73

View File

@@ -59,7 +59,13 @@ python do_populate_cve_db() {
json_url = year_url + ".json.gz"
# Retrieve meta last modified date
response = urllib.request.urlopen(meta_url)
try:
response = urllib.request.urlopen(meta_url)
except urllib.error.URLError as e:
cve_f.write('Warning: CVE db update error, Unable to fetch CVE data.\n\n')
bb.warn("Failed to fetch CVE data (%s)" % e.reason)
return
if response:
for l in response.read().decode("utf-8").splitlines():
key, value = l.split(":", 1)