From d08af47f7adf15fe3f4c214dc5a02ca910eeb9dd Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Sun, 31 Jan 2021 18:00:49 -0600 Subject: [PATCH] Fix ZFS feature generation script This was breaking on FreeBSD, as some of the URLs were returning 404. That raises an HTTPError. If we catch those and skip those sources (just as we were already doing for HTTP codes other than 200), the script completes. But then we get a whole bunch of columns full of "no", which does not seem useful. I added code to skip columns for sources that failed to download. Signed-off-by: Richard Laager --- scripts/compatibility_matrix.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/compatibility_matrix.py b/scripts/compatibility_matrix.py index 5819b11..26bf8b0 100755 --- a/scripts/compatibility_matrix.py +++ b/scripts/compatibility_matrix.py @@ -8,6 +8,7 @@ import logging import sys from collections import defaultdict +from urllib.error import HTTPError from urllib.request import urlopen from datetime import datetime from re import sub as regex, findall @@ -160,13 +161,20 @@ features = defaultdict(list) readonly = dict() for name, sub in sources.items(): + found = {} LOG.debug('Work on %s...', name) for ver, url in sub.items(): LOG.debug('Get %s...', url) - with urlopen(url) as c: - if c.getcode() != 200: - continue - man = c.read().decode('utf-8') + try: + with urlopen(url) as c: + if c.getcode() != 200: + LOG.debug('Failed with HTTP code %d', c.getcode()) + continue + man = c.read().decode('utf-8') + except HTTPError: + LOG.debug('Failed with HTTPError') + continue + found[ver] = url for line in man.split('\n'): if line.startswith('.It '): line = line[4:] @@ -191,6 +199,7 @@ for name, sub in sources.items(): # https://github.com/Nexenta/illumos-nexenta/blob/release-4.0.4-FP/usr/src/common/zfs/zfeature_common.c if name == 'Nexenta' and ver.startswith('4.'): features[('meta_devices', 'com.nexenta')].append((name, ver)) + sources[name] = found os_sources = sources.copy() os_sources.pop(openzfs_key)