From 7dfcfb29032ecc6b7fa33b06cc58b6b8d20e5f6d Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Sun, 27 Jul 2025 18:32:12 +0200 Subject: [PATCH] [citrix-vad-rss] Add auto method --- src/citrix-vad-rss.py | 24 ++++++++++++++++++++++++ src/common/dates.py | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/citrix-vad-rss.py diff --git a/src/citrix-vad-rss.py b/src/citrix-vad-rss.py new file mode 100644 index 00000000..eed67d07 --- /dev/null +++ b/src/citrix-vad-rss.py @@ -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) diff --git a/src/common/dates.py b/src/common/dates.py index 16a2c708..d1238731 100644 --- a/src/common/dates.py +++ b/src/common/dates.py @@ -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,