[citrix-vad-rss] Add auto method

This commit is contained in:
Marc Wrobel
2025-07-27 18:32:12 +02:00
parent 0465481668
commit 7dfcfb2903
2 changed files with 26 additions and 1 deletions

24
src/citrix-vad-rss.py Normal file
View File

@@ -0,0 +1,24 @@
import logging
from common import dates, http
from common.releasedata import ProductData, config_from_argv
"""Fetches EOL dates from Citrix Virtual Apps and Desktops Download Updates RSS feed."""
config = config_from_argv()
with ProductData(config.product) as product_data:
rss = http.fetch_xml(config.url)
for entry in rss.getElementsByTagName("item"):
version_str = entry.getElementsByTagName("title")[0].firstChild.nodeValue
date_str = entry.getElementsByTagName("pubDate")[0].firstChild.nodeValue
version_match = config.first_match(version_str)
if not version_match:
logging.info(f"Skipping unmatched entry: {version_str}")
continue
logging.debug(f"Processing version: {version_str} with date {date_str}")
version = config.render(version_match)
date = dates.parse_datetime(date_str)
product_data.declare_version(version, date)

View File

@@ -54,7 +54,8 @@ def parse_datetime(text: str, formats: list[str] = frozenset([
"%Y-%m-%dT%H:%M:%S%z", # 2023-05-01T08:32:34+0900
"%Y-%m-%dT%H:%M:%S.%f%z", # 2023-05-01T08:32:34.123456Z
"%Y/%m/%d %H:%M:%S", # 2023/05/01 08:32:34
"%a %d %b %Y %H:%M:%S %Z", # Wed, 01 Jan 2020 00:00:00 GMT
"%a, %d %b %Y %H:%M:%S %z", # Wed, 01 Jan 2020 00:00:00 GMT
"%a %d %b %Y %H:%M:%S %z", # Wed 01 Jan 2020 00:00:00 -0400
"%Y%m%d%H%M%S", # 20230501083234
]), to_utc: bool = True) -> datetime:
"""Parse a given text representing a datetime using a list of formats,