diff --git a/release-assistant/tools/compare_pkgs_cvrf_release_branched.py b/release-assistant/tools/compare_pkgs_cvrf_release_branched.py index b8243b28892299dd04e8ab0ec14b7ef74cc91a12..62b407a298c8a5b9727658aae599f13f1433c352 100644 --- a/release-assistant/tools/compare_pkgs_cvrf_release_branched.py +++ b/release-assistant/tools/compare_pkgs_cvrf_release_branched.py @@ -42,23 +42,30 @@ def resolve_xml(cvrf: str) -> dict: xml_result = {} ssl._create_default_https_context = ssl._create_unverified_context cvrf_url = "https://repo.openeuler.org/security/data/cvrf/{}".format(cvrf) - raw_xml = urlopen(cvrf_url) - tree = et.parse(raw_xml) - root = tree.getroot() - - # resolve packages' version from cvrf files. - for branch in root[6]: - if branch.attrib["Name"] == "openEuler": - continue - for product in branch: - version_branch = product.attrib['CPE'].split(":", 3)[-1].replace(":", "-") - pkg_arch = product.text.rsplit(".", 2)[-2] - pkgs_of_branch = xml_result.get(version_branch, {}) - temp_list = pkgs_of_branch.get(pkg_arch, []) - temp_list.append(product.text) - pkgs_of_branch[pkg_arch] = temp_list - xml_result[version_branch] = pkgs_of_branch - return xml_result + try: + raw_xml = urlopen(cvrf_url) + tree = et.parse(raw_xml) + root = tree.getroot() + # resolve packages' version from cvrf files. + for branch in root[6]: + if branch.attrib["Name"] == "openEuler": + continue + for product in branch: + version_branch = product.attrib['CPE'].split(":", 3)[-1].replace(":", "-") + pkg_arch = product.text.rsplit(".", 2)[-2] + pkgs_of_branch = xml_result.get(version_branch, {}) + temp_list = pkgs_of_branch.get(pkg_arch, []) + temp_list.append(product.text) + pkgs_of_branch[pkg_arch] = temp_list + xml_result[version_branch] = pkgs_of_branch + return xml_result + except urllib.error.HTTPError as e: + LOGGER.info("Exception HTTPError %s" % e) + return None + except urllib.error.URLError as e: + LOGGER.info("Exception URLError %s" % e) + return "" + def resolve_html(version_date: str) -> dict: