From 27a73c706fc5f26e311e3cf227319d854895cf35 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Sun, 30 Mar 2025 15:44:35 +0200 Subject: [PATCH] [veeam] Generify veeam-backup-and-replication auto method (#421) (#421) Make veeam-backup-and-replication more generic so that it can be used for other veeam products, such as https://github.com/endoflife-date/endoflife.date/pull/6613 or https://github.com/endoflife-date/endoflife.date/pull/6614. --- src/veeam-backup-and-replication.py | 29 --------------------- src/veeam.py | 39 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 29 deletions(-) delete mode 100644 src/veeam-backup-and-replication.py create mode 100644 src/veeam.py diff --git a/src/veeam-backup-and-replication.py b/src/veeam-backup-and-replication.py deleted file mode 100644 index 8dfd7edc..00000000 --- a/src/veeam-backup-and-replication.py +++ /dev/null @@ -1,29 +0,0 @@ -import re - -from bs4 import BeautifulSoup -from common import dates, http, releasedata - -"""Fetches Veeam versions from https://www.veeam.com.""" - -with releasedata.ProductData("veeam-backup-and-replication") as product_data: - response = http.fetch_url("https://www.veeam.com/kb2680") - soup = BeautifulSoup(response.text, features="html5lib") - - for table in soup.find_all("table"): - headers = [header.get_text().strip().lower() for header in table.find("tr").find_all("td")] - if "build number" not in headers or "release date" not in headers: - continue - - version_index = headers.index("build number") - date_index = headers.index("release date") - for row in table.find_all("tr")[1:]: - cells = row.find_all("td") - if len(cells) <= max(version_index, date_index): - continue - - date_str = cells[date_index].get_text().strip() - if date_str and date_str != "-": - # whitespaces in version numbers are replaced with dashes - version = re.sub(r'\s+', "-", cells[version_index].get_text().strip()) - date = dates.parse_date(date_str) - product_data.declare_version(version, date) diff --git a/src/veeam.py b/src/veeam.py new file mode 100644 index 00000000..1eed3cfa --- /dev/null +++ b/src/veeam.py @@ -0,0 +1,39 @@ +import re +import sys + +from bs4 import BeautifulSoup +from common import dates, endoflife, http, releasedata + +"""Fetches Veeam products versions from https://www.veeam.com. + +This script takes a single argument which is the url of the versions page on https://www.veeam.com/kb2680, +such as `https://www.veeam.com/kb2680`. +""" + +p_filter = sys.argv[1] if len(sys.argv) > 1 else None +m_filter = sys.argv[2] if len(sys.argv) > 2 else None +for config in endoflife.list_configs(p_filter, "veeam", m_filter): + with releasedata.ProductData(config.product) as product_data: + response = http.fetch_url(config.url) + soup = BeautifulSoup(response.text, features="html5lib") + + for table in soup.find_all("table"): + headers = [header.get_text().strip().lower() for header in table.find("tr").find_all("td")] + if "build number" not in headers or "release date" not in headers: + continue + + version_index = headers.index("build number") + date_index = headers.index("release date") + for row in table.find_all("tr")[1:]: + cells = row.find_all("td") + if len(cells) <= max(version_index, date_index): + continue + + date_str = cells[date_index].get_text().strip() + if not date_str or date_str == "-": + continue + + # whitespaces in version numbers are replaced with dashes + version = re.sub(r'\s+', "-", cells[version_index].get_text().strip()) + date = dates.parse_date(date_str) + product_data.declare_version(version, date)