[pan-os] Add automation for versions retrieval (#371)

Based on https://github.com/mrjcap/panos-versions/.

Closes #370.
This commit is contained in:
Marc Wrobel
2024-08-15 10:43:09 +02:00
parent 1424225551
commit 59b6e6aa7c
2 changed files with 12 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ def parse_datetime(text: str, formats: list[str] = frozenset([
"%Y-%m-%d %H:%M:%S %z", # 2023-05-01 08:32:34 +0900
"%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
]), to_utc: bool = True) -> datetime:
"""Parse a given text representing a datetime using a list of formats,

11
src/pan-os.py Normal file
View File

@@ -0,0 +1,11 @@
from common import dates, http, releasedata
"""Fetches pan-os versions from https://github.com/mrjcap/panos-versions/."""
with releasedata.ProductData("pan-os") as product_data:
versions = http.fetch_url("https://raw.githubusercontent.com/mrjcap/panos-versions/master/PaloAltoVersions.json").json()
for version in versions:
name = version['version']
date = dates.parse_datetime(version['released-on'])
product_data.declare_version(name, date)