[pan-os] Add automation for versions retrieval (#371)
Based on https://github.com/mrjcap/panos-versions/. Closes #370.
This commit is contained in:
@@ -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
11
src/pan-os.py
Normal 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)
|
||||
Reference in New Issue
Block a user