Skip to contentSkip to conversation

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

PATCH New Lee Chee Yang 1 participant 1 message Mar 25, 2020

lore
Share & tools
lore
#0 lore raw

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

From: Lee Chee Yang <[email protected]>

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

[YOCTO #13680]

---
 meta/recipes-core/meta/cve-update-db-native.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-core/meta/cve-update-db-native.bb +7 -1
index 575254a..95a0dfc 100644
@@ -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)
Signature · 1 line
2.7.4